"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 tmp = permutation.slice(0, permutation[i]).sort();

    if (permutation[permutation[i] - 1] <= tmp) {
      result++;
    }
  }
  console.log(result);
}
