Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]

a = list(set(A))
d = {}
for aa in a:
  if(A.count(aa)%2 == 1):
    d[aa] = A.count(aa)
print(len(d))

"""
memo = []
for i in range(N):
  A = int(input())
  if(A not in memo):
    memo.append(A)
  else:
    memo.remove(A)
print(len(memo))
"""

### FIXED CODE ###

N = int(input())
A = [input() for _ in range(N)]

memo = {}
for a in A:
  if(a not in memo):
    memo[a] = 0
  else:
    memo.pop(a)
print(len(memo))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))

min_ans = 100000000
for b in range(-max(A), max(A)):
    ans = 0
    for i in range(len(A)):
        #print(A[i], b, i, abs(A[i] - (b + i + 1)))
        ans += abs(A[i] - (b + i + 1))
    #print("ans", b, ans)
    if min_ans >= ans: min_ans = ans
    #else: break

"""b = -1
min_ans_b = 10000000
while True:
    ans = 0
    for i in range(len(A)):
        #print(A[i], b, i, abs(A[i] - (b + i + 1)))
        ans += abs(A[i] - (b + i + 1))
    #print("ans", b, ans)
    if min_ans_b >= ans: min_ans_b = ans
    else: break
    b -= 1


if min_ans_b < min_ans:
    min_ans = min_ans_b
"""
print(min_ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] -= i + 1

A = sorted(A)
b = A[N//2]
sad = 0
for i in A:
    sad += abs(i - b)

print(sad)
### BUGGY CODE ###

n, m = map(int, input().split())
dp = [[0]+[10**6] * (2**n-1) for i in range(m+1)]
for i in range(m):
    a, b = map(int, input().split())
    bit = ['0'] * n
    for x in set(map(int, input().split())):
        bit[x-1] = '1'
    bit = int(''.join(bit[::-1]), 2)
    for j, dpnw in enumerate(dp[i]):
        dp[i+1][j] = dpnw
    for j, dpnw in enumerate(dp[i]):
        dp[i+1][j | bit] = min(dp[i+1][j | bit], dp[i][j | bit], a + dpnw)
if dp[m][-1] == 1000000:
    print(-1)
else:
    print(dp[m][-1])

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

INF = 10**6

n, m = map(int, input().split())
dp = [INF] * (2**n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split())
    bit = ['0'] * n
    for x in set(map(int, input().split())):
        bit[x-1] = '1'
    bit = int(''.join(bit[::-1]), 2)
    for j in range(2**n-1, -1, -1):
        dp[j|bit] = min(dp[j|bit], a + dp[j])
if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])
### BUGGY CODE ###

N, M = map(int, input().split())

p_list = []
y_list = []
shi_map = {}

for i in range(M):
    p, y = map(int, input().split())
    p_list.append(p)
    y_list.append(y)
    if p in shi_map:
        shi_map[p].append(y)
    else:
        shi_map[p] = [y]

for i in range(M):
    p = p_list[i]
    y = y_list[i]
    s_m = shi_map[p]
    s_m = sorted(s_m)
    j = s_m.index(y)
    p_str = str(p).zfill(6)
    j_str = str(j+1).zfill(6)
    print(p_str + j_str)



### FIXED CODE ###

N, M = map(int, input().split())

shi_map = []

for i in range(M):
    p, y = map(int, input().split())
    shi_map.append([i, p, y])

shi_map = sorted(shi_map, key=lambda x: (x[1], x[2]))

result = {}
shi_count = {}
for i, p, y in shi_map:

    if p in shi_count:
        c = shi_count[p]
        count = c + 1
        shi_count[p] = count
    else:
        shi_count[p] = 1
        count = 1
    result[i] = [p, count]
result = list(sorted(result.items(), key=lambda x: x[0]))

for i, p in result:

    p2 = str(p[0]).zfill(6)

    y = str(p[1]).zfill(6)
    r = p2+y
    print(r)
### BUGGY CODE ###

# 考えると、隣り合う列は結局 2*H 回ずることになり、
# それぞれの列間について最適な沈め順を見つけると、
# その順序関係を崩さないように全体の順番も構築できる（トポロジカルソートみたいに）ので、
# 各列間の最適解を求めて総和をとればいい

from itertools import accumulate
inf = 2 * 10**9
H, W = map(int, input().split())
C = [input() for _ in range(H)]
C_T = list(zip(*C))
ans = 0
for C1, C2 in zip(C_T[:-1], C_T[1:]):
    # Z[i][j] := i 個ずれてて沈んでない方が j 個沈んでる状態の連結個数
    Z1 = []  # 左を押したとき（右が上にあるとき）
    Z2 = []  # 右を押したとき（左が上にあるとき）
    z1 = list(accumulate([int(c1==c2) for c1, c2 in zip(C1, C2)]))
    z1.reverse();  z1.append(0)
    Z1.append(z1)
    Z2.append([])
    for j in range(1, H+1):
        z1 = list(accumulate([int(c1==c2) for c1, c2 in zip(C1, C2[j:])]))
        z1.reverse();  z1.append(0);  Z1.append(z1)
        z2 = list(accumulate([int(c1==c2) for c1, c2 in zip(C1[j:], C2)]))
        z2.reverse();  z2.append(0);  Z2.append(z2)
    # dp[i][j] := 左を i 個、右を j 個沈めるまでの最小コスト  # 逆かも（どっちでもいい）
    dp = [[inf] * (H+2) for _ in range(H+2)]
    dp[0][0] = 0
    for j in range(H+1):
        for k in range(H+1):
            cost = dp[j][k] + (Z1[j-k][k] if j>=k else Z2[k-j][j])
            dp[j+1][k] = min(dp[j+1][k], cost)
            dp[j][k+1] = min(dp[j][k+1], cost)
    ans += dp[H][H]
print(ans)


### FIXED CODE ###

# 考えると、隣り合う列は結局 2*H 回ずることになり、
# それぞれの列間について最適な沈め順を見つけると、
# その順序関係を崩さないように全体の順番も構築できる（トポロジカルソートみたいに）ので、
# 各列間の最適解を求めて総和をとればいい

def accumulate_reverse(S1, S2):
    n = min(len(S1), len(S2))
    res = [0] * (n+1)
    c = 0
    for i in range(n):
        if S1[i] == S2[i]:
            c += 1
        res[n-i-1] = c
    return res

inf = 10**8
H, W = map(int, input().split())
C = [input() for _ in range(H)]
C_T = list(zip(*C))
C_T = ["".join(s) for s in C_T]
ans = 0
for C1, C2 in zip(C_T[:-1], C_T[1:]):
    # Z[i][j] := i 個ずれてて沈んでない方が j 個沈んでる状態の連結個数
    Z1 = []  # 左を押したとき（右が上にあるとき）
    Z2 = []  # 右を押したとき（左が上にあるとき）
    Z1.append(accumulate_reverse(C1, C2))
    for j in range(1, H+1):
        Z1.append(accumulate_reverse(C1, C2[j:]))
        Z2.append(accumulate_reverse(C1[j:], C2))
    Z1 += Z2[::-1]
    # dp[i][j] := 左を i 個、右を j 個沈めるまでの最小コスト  # 逆かも（どっちでもいい）
    dp = [[inf] * (H+2) for _ in range(H+2)]
    dp[0][0] = 0
    for j in range(H+1):
        for k in range(H+1):
            cost = dp[j][k] + Z1[j-k][min(j, k)]
            dp[j+1][k] = min(dp[j+1][k], cost)
            dp[j][k+1] = min(dp[j][k+1], cost)
    ans += dp[H][H]
print(ans)
### BUGGY CODE ###

from collections import defaultdict
from queue import Queue
n, m = list(map(int, input().split()))
MX = int(1e6)
edge = defaultdict(set)
kenedge = defaultdict(set)
dist = [MX for i in range(n)]
reached = [False for i in range(n)]

for loop in range(m):
    a, b = list(map(int, input().split()))
    edge[a-1].add(b-1)

for i in range(n):
    step1 = set()
    for ii in edge[i]:
        step1 |= edge[ii]
    step2 = set()
    for iii in step1:
        step2 |= edge[iii]
    step3 = set()
    for iiii in step2:
        kenedge[i].add(iiii)

s, t = list(map(int, input().split()))
s = s-1
t = t-1
dist[s] = 0

q = Queue()
q.put(s)
reached[s] = True
while not q.empty():
    node = q.get()
    for next_node in kenedge[node]:
        if reached[next_node]: continue
        reached[next_node] = True
        q.put(next_node)
        dist[next_node] = min(dist[next_node], dist[node] + 1)

if dist[t] == MX:
    print(-1)
else:
    print(dist[t])



### FIXED CODE ###

from collections import defaultdict
from queue import Queue

n, m = list(map(int, input().split()))
MX = int(1e6)
edge = defaultdict(set)
dist = [[MX, MX, MX] for i in range(n)]
reached = [[False, False, False] for i in range(n)]

for loop in range(m):
    a, b = list(map(int, input().split()))
    edge[a-1].add(b-1)

s, t = list(map(int, input().split()))
s = s-1
t = t-1
dist[s][0] = 0

q = Queue()
q.put((s, 0))
while not q.empty():
    node, step = q.get()
    next_step = (step + 1) % 3
    for next_node in edge[node]:
        if reached[next_node][next_step]: continue
        q.put((next_node, next_step))
        reached[next_node][next_step] = True
        if step == 2:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step] + 1)
        else:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step])

if dist[t][0] == MX:
    print(-1)
else:
    print(dist[t][0])
### BUGGY CODE ###

import numpy as np
H,W,M=map(int, input().split())
hl=np.array([0 for i in range(H+1)])
wl=np.array([0 for i in range(W+1)])
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
# hmax= [i for i, x in enumerate(hl) if x ==a]
# wmax=[i for i, x in enumerate(wl) if x ==b]
hmax=np.where(hl == hl.max())[0]
wmax=np.where(wl == wl.max())[0]
a=max(hl)
b=max(wl)
bl=False
if len(hmax)*len(wmax)>M:
    bl=True
else:
    for x in hmax:
        for y in wmax:
            if [x,y] not in ms:
                bl=True
                break
        if bl:
            break
if bl:
    print(a+b)
else:
    print(a+b-1)

### FIXED CODE ###


H,W,M=map(int, input().split())
hl=[0 for i in range(H+1)]
wl=[0 for i in range(W+1)]
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax=[]
wmax=[]
s=0
for x in ms:
    if  hl[x[0]]==a and wl[x[1]]==b:
        s+=1
c=hl.count(a)
d=wl.count(b)
if s<c*d:
    print(a+b)
else:
    print(a+b-1)
### BUGGY CODE ###

S = input()
a = []
count = 0
for n in range(len(S)):
    a.append(10**n%2019)
for n in range(len(S)-3):
    z = int(S[-n-1])*a[0]+int(S[-n-2])*a[1]+int(S[-n-3])*a[2]+int(S[-n-4])*a[3]
    if z%2019 == 0:
        count += 1
    for m in range(len(S)-n-4):
        z += int(S[-m-n-5])*a[m+4]
        if z%2019 == 0:
            count += 1
print(count)

### FIXED CODE ###

S = input()
l = len(S)
a = [0]
b = [0]*2019
c = [1]
d = 0
e = 0
for n in range(l-1):
    c.append(c[n]*10%2019)
for n in range(l):
    d += int(S[-n-1])*c[n]
    a.append(d%2019)
for n in range(l+1):
    b[a[n]] += 1
for n in range(2019):
    e += int(b[n]*(b[n]-1)/2)
print(e)
### BUGGY CODE ###

X = int(input())
for i in range(-3000, 3000):
    for j in range(-3000, 3000):
        if X == (i**5-j**5):
            print(i, j)
            break


### FIXED CODE ###

X = int(input())
f = False
i = 0
while i < 3000:
    if f:
        break
    j = i-1
    while True:
        if X < (i**5-j**5):
            break
        if X == (i**5-j**5):
            print(i, j)
            f = True
            break
        j -= 1
    i += 1
### BUGGY CODE ###


import math
N=int(input())

n=110000
count=0
isprime=[True]*(n+1)
isprime[0]=False
isprime[1]=False
for i in range(2,int(math.sqrt(n))+1):
    if isprime[i]==True:
        j=i+i
        while j<=n:
            isprime[j] =False
            j=j+i
for k in range(N):
    l,r=map(int,input().split())
    count=0
    for i in range(l,r+1):
        if isprime[i]==True:
            if isprime[(i+1)//2]==True:
                count+=1
    print(count)

    


### FIXED CODE ###


import math
N=int(input())
S=[0]*100010
n=110000
count=0
isprime=[True]*(n+1)
isprime[0]=False
isprime[1]=False
for i in range(2,int(math.sqrt(n))+1):
    if isprime[i]==True:
        j=i+i
        while j<=n:
            isprime[j] =False
            j=j+i

for i in range(2,100010):
    if isprime[i]==True:
        if isprime[(i+1)//2]==True:
            count+=1
    
    S[i]=count
        
                
    

    
for k in range(N):
    l,r=map(int,input().split())
    
    print(S[r]-S[l-1])
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・1,11,111,...に分解して9個ずつまとめる
・9倍して考える。9N+x の digit sum <= x となる最小のxが知りたい
・xが満たせばx+1も満たすので、二分探索できる
"""

N = int(read())

N *= 9

def digit_sum(N):
    return sum(map(int,str(N)))

def test(N,x):
    return digit_sum(N + x) <= x

left = 0
right = len(str(N)) * 9 + 100
while left + 1 < right:
    x = (left + right) // 2
    if test(N,x):
        right = x
    else:
        left = x

answer = (right + 8) // 9
print(answer)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・1,11,111,...に分解して9個ずつまとめる
・9倍して考える。9N+x の digit sum <= x となる最小のxが知りたい
・xが満たせばx+1も満たすので、二分探索できる
"""

N = [x - ord('0') for x in map(int,read().rstrip())][::-1]

# とりあえず 9 倍
N = [9 * x for x in N] + [0] * 10
L = len(N)

for i in range(L-1):
    q,r = divmod(N[i],10)
    N[i] = r
    N[i+1] += q

high1 = sum(N[10:])
N[10] += 1
for i in range(10,L-1):
    if N[i] == 10:
        N[i] = 0
        N[i+1] += 1
high2 = sum(N[10:])
low = N[:10]

low = sum(x * 10 ** i for i,x in enumerate(N[:10]))

A = 10 ** 10

def digit_sum(N):
    return sum(map(int,str(N)))

def test(x):
    if low + x >= A:
        return digit_sum(low + x) - 1 + high2 <= x
    return digit_sum(low + x) + high1 <= x

left = 0
right = 10 ** 10
while left + 1 < right:
    x = (left + right) // 2
    if test(x):
        right = x
    else:
        left = x

answer = (right + 8) // 9
print(answer)
### BUGGY CODE ###

MOD = 10**9 + 7
N = 2 * 10**6 + 10  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod MOD)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod MOD)
inv = [0, 1]  

def nCr(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

k = int(input())
s = len(input())

ans = 0
for i in range(k+1):
    ansp =  pow(26,i,MOD) * pow(25,k-i,MOD) * nCr(s+k-1-i,s-1,MOD) % MOD 
    ans = (ans + ansp) % MOD
print(ans)


### FIXED CODE ###

MOD = 10**9 + 7
N = 2 * 10**6 + 10  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod MOD)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod MOD)
inv = [0, 1]  

def nCr(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

k = int(input())
s = len(input())

ans = 0
for i in range(k+1):
    ansp =  pow(26,i,MOD) * pow(25,k-i,MOD) * nCr(s+k-1-i,s-1,MOD) % MOD 
    ans = (ans + ansp) % MOD
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))

arr = []
tmp = 0

for n in P:
  arr.append((n*(n+1)/2)/n)

for i in range(0, N - K + 1):
  max_value = 0
  max_value = sum(arr[i:i+K])
  if max_value >= tmp: 
    tmp = max_value

print("{:.12f}".format(tmp))


### FIXED CODE ###

import queue

N, K = map(int, input().split())
P = list(map(int, input().split()))

q = queue.Queue()

#arr = [(n+1)/2 for n in P]
mx = 0
s = 0

for i in range(N):
  s += P[i]+1
  q.put(P[i]+1)
  if q.qsize() > K:
    s -= q.get()
  if q.qsize() == K:
    mx = max(mx, s)

ans = mx/2
print(ans)
### BUGGY CODE ###

n,x,y = map(int,input().split())
ans = [0 for i in range(n)]
for i in range(n):
    for j in range(i,n):
        ans[min(j-i,(abs(i-(x-1))+1+abs(y-1-j)),(abs(i-(x-1))+1+abs(y-1-j)))] += 1
for i in range(1,n):
    print(ans[i])


### FIXED CODE ###

n,x,y = map(int,input().split())
ans = [0]*n
for i in range(n):
    for j in range(i,n):
        ans[min(j-i,(abs(i-(x-1))+1+abs(y-1-j)),(abs(i-(x-1))+1+abs(y-1-j)))] += 1
for i in range(1,n):
    print(ans[i])
### BUGGY CODE ###

import sys
for line in sys.stdin:
    n=int(line)
    ans=0
    plist = [1 for i in xrange(n+1)]
    plist[0]=0
    plist[1]=0
    for x in xrange(len(plist)):
        if plist[x] == 1:
            ans+=1
            i=2
            while x*i < len(plist):
                plist[x*i] = 0
                i+=1
    print ans

### FIXED CODE ###

#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)
### BUGGY CODE ###

N=int(input())
Sarr1=[]
Sarr2=[]
for _ in range(N):
    s=input()
    if Sarr1.count(s)==0:
        Sarr1.append(s)
        Sarr2.append(0)
    else:
        i=Sarr1.index(s)
        Sarr2[i]+=1
ans=[]
m=max(Sarr2)
for i in range(len(Sarr2)):
    if Sarr2[i]==m:
        ans.append(Sarr1[i])
    else:
        pass
FA=sorted(ans)
for z in FA:
    print(z)

### FIXED CODE ###

from collections import Counter

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=Counter(S)
arr=c.most_common()

maxnum=arr[0][1]
ans=[]

for i in range(len(arr)):
    if arr[i][1]==maxnum:
        ans.append(arr[i][0])        
    else:
        break
FA=sorted(ans)
for j in FA:
    print(j)
### BUGGY CODE ###

import numpy as np

N, X, Y = map(int, input().split())
X -= 1
Y -= 1

ans = [0] * (N-1)

c = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        d1 = abs(j - i)
        d2 = abs(X - i) + 1 + abs(j - Y)
        d3 = abs(Y - i) + 1 + abs(j - X)
        ans[min(d1, d2, d3) - 1] += 1

[print(ans[i]) for i in range(N - 1)]


### FIXED CODE ###

import numpy as np

N, X, Y = map(int, input().split())
X -= 1
Y -= 1

ans = [0] * (N-1)

for i in range(N - 1):
    for j in range(i + 1, N):
        d1 = abs(j - i)
        d2 = abs(X - i) + 1 + abs(j - Y)
        ans[min(d1, d2) - 1] += 1

[print(ans[i]) for i in range(N - 1)]
### BUGGY CODE ###

N,M = map(int,input().split(" "))
fact = {}
for i in range(2,M):
    while (M%i == 0):
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
        M //= i
    if (M == 1):
        break


MOD = 10**9+7

def nCr_mod(n,r,mod): #nCrmod
    r = min(n-r,r)
    v = 1
    for i in range(r):
        v = (v * ((n-i)%mod) * pow((i+1),mod-2,mod)) % mod
    return v

ans = 1
for key,item in fact.items():
    ans *= nCr_mod((item + (N) - 1),N-1,MOD)
    ans %= MOD
print(ans)

### FIXED CODE ###

N,M = map(int,input().split(" "))
fact = {}
for i in range(2,M):
    while (M%i == 0):
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
        M //= i
    if (M == 1):
        break


MOD = 10**9+7

def nCr_mod(n,r,mod): #nCrmod
    r = min(n-r,r)
    v = 1
    for i in range(r):
        v = (v * ((n-i)%mod) * pow((i+1),mod-2,mod)) % mod
    return v

ans = 1
for key,item in fact.items():
    ans *= nCr_mod((item + (N) - 1),N-1,MOD)
    ans %= MOD
print(ans)
### BUGGY CODE ###

import itertools
N=int(input())
L=list(map(int,input().split()))
 
p=itertools.combinations(L,3)
q=itertools.combinations(L,2)
d={}
for i in q:
  d[i]=i[0]+i[1]
s=0
for i in p:
  x=d[i[0],i[1]]
  y=d[i[1],i[2]]
  z=d[i[0],i[2]]
  if i[0]<y and i[1]<z and i[2]<x:
    s += 1
 
print(s)

### FIXED CODE ###

from bisect import bisect_left
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):#一番短い棒
  for j in range(i+1,n):#二番目に短い棒
    #1+2番目の棒の長さより短く、2番目に短い棒より長い棒の範囲を探す
    ans += bisect_left(l,l[i]+l[j])-(j+1)
print(ans)
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
cnt = 0
S = 0
for i in range(100000):
    tmp = a.count(i + 1)
    S += tmp
    if tmp > i + 1:
        cnt += tmp - i - 1
    elif tmp < i + 1:
        cnt += tmp
cnt += N - S
print(cnt)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
tmp = 1
cnt = 0
S = 0
a.sort()
a.append(0)
for i in range(N):
    if a[i] == a[i + 1]:
        tmp += 1
    else:
        if tmp > a[i]:
            cnt += tmp - a[i]
        elif tmp < a[i]:
            cnt += tmp
        tmp = 1
print(cnt)
### BUGGY CODE ###

def main():
    mod = 10**9+7
    inv_n = [0]*1001
    nCr = [[0]*(i+1) for i in range(1001)]
    for i in range(1001):
        inv_n[i] = pow(i, mod-2, mod)
    for i in range(1001):
        nCr[i][0] = 1
        nCr[i][i] = 1
    for i in range(2, 1001):
        for j in range(1, i):
            nCr[i][j] = (nCr[i-1][j-1]+nCr[i-1][j]) % mod
    n, a, b, c, d = map(int, input().split())
    f = [[[0]*(N//A-c+1) for A in range(a, b+1)] for N in range(1, n+1)]
    for N in range(1, n+1):
        for A in range(a, min(N//c, b)+1):
            temp = 1
            for C in range(1, c):
                temp = temp*nCr[N-(C-1)*A][A]*inv_n[C] % mod
            for C in range(c, min(d, N//A)+1):
                temp = temp*nCr[N-(C-1)*A][A]*inv_n[C] % mod
                f[N-1][A-a][C-c] = temp

    dp = [0]*(n+1)
    dp[0] = 1

    for A in range(a, b+1):
        dp2 = [i for i in dp]
        for C in range(c, d+1):
            for i in range(n-C*A+1):
                dp2[i+C*A] = (dp2[i+C*A]+f[n-i-1][A-a][C-c]*dp[i]) % mod
        dp = dp2
    print(dp[-1])


main()

### FIXED CODE ###

def main():
    mod = 10**9+7
    inv_n = [0]*1001
    nCr = [[1]*(i+1) for i in range(1001)]
    for i in range(1001):
        inv_n[i] = pow(i, mod-2, mod)
    for i in range(2, 1001):
        for j in range(1, i):
            nCr[i][j] = (nCr[i-1][j-1]+nCr[i-1][j]) % mod
    n, a, b, c, d = map(int, input().split())
    dp = [0]*(n+1)
    dp[0] = 1

    for A in range(b, a-1, -1):
        dp2 = [i for i in dp]
        for N in range(n-c*A, -1, -1):
            e = dp[N]
            if e:
                temp = 1
                for C in range(1, c):
                    temp = temp*nCr[n-N-(C-1)*A][A]*inv_n[C] % mod
                for C in range(c, min(d, (n-N)//A)+1):
                    temp = temp*nCr[n-N-(C-1)*A][A]*inv_n[C] % mod
                    dp2[N+C*A] = (dp2[N+C*A]+temp*e) % mod
        dp = dp2
    print(dp[-1])


main()
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]

import numpy
res = numpy.cumsum(A)

ans = 10 ** 18
for i in range(N-1):
    x = res[i]
    ans = min(abs(x - (sum(A)-x)), ans)
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

A_sum = sum(A)
check = 0
ans = 10 ** 18
for i in range(N-1):
    check += A[i]
    ans = min(abs(check - (A_sum - check)), ans)
print(ans)
### BUGGY CODE ###

s=input()
l=len(s)
mod=2019
cnt=0

i=0
while -3-i!=-l:
    if int(s[-3-i:])%mod==0:
        cnt+=1
    i+=1

k=1
while -k!=-(l-3):
    j=1
    while -3-k-j!=-l-1:
        if int(s[-3-k-j:-k])%mod==0:
            cnt+=1
        j+=1

    k+=1
print(cnt)

### FIXED CODE ###

s= input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    num = sum_of_digits % 2019
    d *= 10
    d %=2019
    cnts[num] += 1
 
ans = 0
    
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)
### BUGGY CODE ###

K = int(input())
cnt = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            for i in range(1,min(a,b,c)+1):
                if a%i == b%i == c%i == 0:
                    tcnt = i
            cnt += tcnt
print(cnt)

### FIXED CODE ###

K = int(input())
ans = 0
import math

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += math.gcd(math.gcd(a,b),c)
print(ans)
### BUGGY CODE ###

x = int(input())
for a in range(-int(x**0.5), int(x**0.5)):
    for b in range(-int(x**0.5), int(x**0.5)):
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break

### FIXED CODE ###

x = int(input())
for a in range(-int(x**0.3), int(x**0.3) + 1):
    for b in range(-int(x**0.3), int(x**0.3) + 1):
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break