cswork / OA打开练习工作台

CanvaOA #2

Order Check (Backend)

估计简单可在线判题

考点(AI 标注)原地数组

After sorting by height in ascending order, count the students in the original array who are not in their correct position.

This site's standard I/O format and any supplementary ranges follow this problem's statement.

输入格式

n (1≤n≤100000), and the next line contains n heights (1≤height[i]≤10^9). The value ranges come from the original problem.

输出格式

Output the number of students in incorrect positions.

样例 1

输入:

6
1 1 3 3 4 1

输出:

3

样例 2

输入:

5
1 1 3 4 1

输出:

3

样例 3

输入:

1
1

输出:

0