import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /**5 * * @author muran4 */ public class Monsters { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String line; String[] arr; int[] serie; int num; while((line = input.readLine())!=null){ num = Integer.parseInt(line); line = input.readLine(); //arr = line.split(" "); // Scanner in = new Scanner(line); int position[] = new int[num+1]; serie = new int[num]; // position = new int[num+1]; int pocet = 0; int x = 0; arr = line.split(" "); for (int i = 0; i < num; i++) { serie[i] = Integer.parseInt(arr[i]); position[serie[i]] = i; // if(serie[i] serie[i] && serie[serie[i]] == i)System.out.println(i); // if(i> serie[i] && serie[serie[i]] == i)pocet--; // if(i == serie[i])x++; } int pos; int temp; for (int i = 0; i < num; i++) { if(serie[i]!=i+1){ temp = serie[i]; serie[i] = i+1; position[temp] = position[serie[i]]; serie[position[serie[i]]] = temp; pocet++; } } System.out.println(pocet); // int out = num+pocet-1; // if(x > 0)out-=(x-1); //// System.out.println(num+pocet-1+" "+(x-1)); // System.out.println(out); } } }