import java.util.Arrays;
/**
* @author xnl
* @Description:
* @date: 2022/6/13 21:07
*/
public class Solution {
public static void main(String[] args) {
Solution solution = new Solution();
int[] arr = {1,1,4,2,1,3};
System.out.println(solution.heightChecker(arr));
}
public int heightChecker(int[] heights) {
int[] ints = Arrays.copyOfRange(heights, 0 , heights.length);
Arrays.sort(ints);
int ans = 0;
for (int i = 0; i < heights.length; i++){
if (ints[i] != heights[i]){
ans++;
}
}
return ans;
}
}