using System; namespace JengaSort { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int[] a = new int[N]; string[] vals = Console.ReadLine().Split(' '); for(int i=0; i < N; i++) { a[i] = int.Parse(vals[i]); } int max = 0; int count = 0; for(int i=0; i< N; i++) { if (a[i] < max) { count++; } else { max = a[i]; } } Console.WriteLine(count); } } }