void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var N = ss.Next(int.Parse); var A = ss.Next(int.Parse, N); var dic = new Dictionary <int, int>(); foreach (var a in A) { if (dic.ContainsKey(a)) { dic[a]++; } else { dic.Add(a, 1); } } sw.WriteLine(dic.Sum(x => x.Value >= x.Key ? x.Value - x.Key : x.Value)); //--------------------------------- }