using System; public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); string[] line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); getAns(n, a); } static void getAns(int n, int[] a) { var np = 0; for (int i = 0; i < n; i++) { if (a[i] == n) { np = i; break; } } var count = 1; var t = n; for (int i = np - 1; i >= 0; i--) { if (a[i] < t) { count++; t = a[i]; } } Console.WriteLine(n - count); } }