import collections N,M=map(int,input().split()) b=[ list(map(int,input().split())) for i in range(N) ] c=[] count=0 for i in b: c.append(i[1]) w=collections.Counter(c) for i in w.values(): if i >= 2: count += i//2 + i % 2 print(count)