"use strict";
main(require("fs").readFileSync("/dev/stdin", "UTF-8"));

function main(input) {
  input = input.split("\n");
  const N = input.shift();
  const permutation = input[0].split(" ");

  let result = 0;

  for (let i = 0; i < N; i++) {
    let isOK = true;
    for (let f = 0; f < permutation[i]; f++) {
      if (permutation[permutation[i] - 1] > permutation[f]) {
        isOK = false;
      }
    }
    result += isOK ? 1 : 0;
  }
  console.log(result);
}
