P28696 [洛谷] Strictly Increasing Sequence
普及+
题目描述

Problem Description

Given a sequence of numbers \( A_1, A_2, \cdots, A_n \), modify the fewest number of elements to be real numbers such that the sequence becomes strictly monotonically increasing.

Note: The original problem incorrectly stated that the modifications should be integers. This has been corrected to real numbers. The provided data ensures that the solution using integer modifications can also be accepted (though it will not pass the sample cases).

Input Format

The first line contains an integer \( n \).

The second line contains \( n \) integers \( A_1, A_2, \cdots, A_n \).

Output Format

Output a single integer representing the minimum number of elements to be modified.

Sample Input and Output

Sample Input #1

3
1 3 2

Sample Output #1

1

Sample Input #2

8
1 2 3 4 4 5 6 7

Sample Output #2

1

Notes

  • For 50% of the test cases, \( N \le 10^3 \).
  • For 100% of the test cases, \( 1 \le N \le 10^5 \) and \( 1 \le A_i \le 10^9 \).
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 3 2
样例输出
1