import java.util.*; public class No365{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList a = new ArrayList(); for(int i = 0; i < n; i++){ a.add(sc.nextInt()); } int count = 0; int idx = 0; for(int i = 0; i < n; i++){ if(a.get(idx) != i+1){ a.remove(a.indexOf(i+1)); count++; }else{ idx++; } } System.out.println(count); } }