N,M = list(map(int, input().split())) g = [ [] for _ in range(2*N)] for _ in range(M): a,b = list(map(int, input().split())) g[a-1].append(b-1) g[b-1].append(a-1) relation_cnt = [] for i in range(2*N): relation_cnt.append([i, len(g[i])]) relation_cnt.sort(key=lambda x:x[1]) paired = set() for i in range(2*N): node, cnt = relation_cnt[i] for node2 in g[node]: if node2 in paired or node in paired : continue paired.add(node) paired.add(node2) # print(paired) print((2*N - len(paired))//2)