import std.stdio;
import std.algorithm;
import std.conv;
import std.array;
import std.string;
import std.math;
import std.functional;
import std.range;
import std.typecons;
import std.format;

void main(string[] args) {
  readln;
  readln.solve.writeln;
}

auto solve(string line1) {
  auto hash = line1.chomp.split.map!(to!long).array.counter;
  long res;
  foreach(k, v; hash) {
    if (k < v) {
      res += v - k;
    } else if (v < k) {
      res += v;
    }
  }
  return res;
} unittest {
  assert(solve("3 3 3 3") == 1, "1");
  assert(solve("2 4 1 4 2") == 2, "2");
  assert(solve("1 2 2 3 3 3") == 0, "3");
  assert(solve("1000000000") == 1, "4");
  assert(solve("2 7 1 8 2 8 1 8") == 5, "4");
}

pure auto counter(N = int, E)(E[] arr) {
  N[E] hash;
  foreach(e; arr) {
    hash[e]++;
  }
  return hash;
}