import java.io.BufferedInputStream; import java.util.Scanner; public class Main { static final long C = 1000000007; static final int CY = 1000000000; StringBuilder sb; public void calc() { sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); int n = sc.nextInt(); int[] a = new int[n]; for (int i=0; i < n; i++) { a[i] = sc.nextInt(); } long ans = 0; int bef = n+1; for (int i=n-1; i >= 0; i--) { if (bef-1 != a[i]) { ans++; }else { bef = a[i]; } } System.out.println(ans); } public static void main(String[] args) { Main main = new Main(); main.calc(); } }