import java.util.Arrays; import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int n=scanner.nextInt(); int a[]=new int[n]; int max=0; int ind=0; for(int i=0;imax){ max=a[i]; ind=i; } } int ax[]=deepCopy(a); Arrays.sort(ax); int oks=0; int j=ax.length-1; for(int i=ind;i>=0;i--){ if(a[i]==ax[j]){ oks++; j--; } } System.out.println(a.length-oks); } private static int[] deepCopy(int[] array) { int[] newArray = new int[array.length]; System.arraycopy(array, 0, newArray, 0, array.length); return newArray; } }