import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Monsters {

    public static void main(String[] args) {

        while (true) {

            int[] arr = null;
            HashMap<Integer, Integer> hashMap = new HashMap<>();
            int swaps = 0;

            try {
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                String s = br.readLine();
                if (s == null) break;
                if (s.isEmpty()) break;
                int n = Integer.parseInt(s);
                arr = new int[n];
                String[] sep = br.readLine().split(" ");

                for (int i = 0; i < sep.length; i++) {
                    arr[i] = Integer.parseInt(sep[i]);
                    hashMap.put(arr[i], i);
                }

            } catch (IOException e) {
                break;
            }

            if (arr == null) break;

            for (int i = 0; i < arr.length; i++) {
                if (arr[i] != i+1) {
                    swaps++;
                    int tmp = arr[i];
                    arr[i] = i + 1;
                    arr[hashMap.get(i+1)] = tmp;
                    hashMap.replace(tmp, hashMap.get(i+1));
                }
            }

            System.out.println(swaps);


        }



    }

}
