def uf_find(n,p): ufl = [] while p[n] != n: ufl.append(n) n = p[n] for i in ufl: p[i] = n return n def uf_union(a,b,p,rank): ap = uf_find(a,p) bp = uf_find(b,p) if ap == bp: return True else: if rank[ap] > rank[bp]: p[bp] = ap size[ap] += size[bp] elif rank[ap] < rank[bp]: p[ap] = bp size[bp] += size[ap] else: p[bp] = ap rank[ap] += 1 size[ap] += size[bp] return False N,M = map(int,input().split()) N *= 2 p = [i for i in range(N)] rank = [0] * N size = [1] * N for i in range(M): A,B = map(int,input().split()) A-=1 B-=1 uf_union(A,B,p,rank) ans = 0 for i in range(N): if uf_find(i,p)==i: ans += size[i]%2 print (ans//2)