import std.stdio, std.array, std.algorithm, std.string, std.conv, std.math;

void main() {
  int n = readln.chomp.to!int;
  int[int] chie;
  auto b = map!(x => x.to!int)(readln.chomp.split);
  int res = 0;
  foreach (x; b) {
    ++chie[x];
  }
  foreach (x, cnt; chie) {
    res += min(abs(cnt - x), cnt);
  }
  writeln(res);
}
