N,M=map(int,input().split()) # UnionFind Group = [i for i in range(2*N+1)] # グループ分け Nodes = [1]*(2*N+1) # 各グループのノードの数 def find(x): while Group[x] != x: x=Group[x] return x def Union(x,y): if find(x) != find(y): if Nodes[find(x)] < Nodes[find(y)]: Nodes[find(y)] += Nodes[find(x)] Nodes[find(x)] = 0 Group[find(x)] = find(y) else: Nodes[find(x)] += Nodes[find(y)] Nodes[find(y)] = 0 Group[find(y)] = find(x) for i in range(M): a,b=map(int,input().split()) Union(a,b) ANS=0 for i in range(1,2*N+1): if find(i)==i: ANS+=Nodes[i]%2 print(ANS//2)