N = int(input()) A = list(map(int,input().split())) B = set(A) a = len(A) b = len(B) if 2*b-a < 0 : print(0) else : print(2*b-a)