def root(x): if P[x] < 0: return x P[x] = root(P[x]) # 経路圧縮 return P[x] def merge(x,y): x = root(x) y = root(y) if x == y: return if x > y: x,y = y,x P[x] += P[y] P[y] = x def same(x,y): return root(x) == root(y) def size(x): x = root(x) return -P[x] N,M = map(int,input().split()) P = [-1] * (N * 2) for i in range(M): a,b = map(int,input().split()) a -= 1 b -= 1 merge(a,b) tmp = 0 S = set() for i in range(2 * N): if root(i) not in S: tmp += size(i) % 2 S.add(root(i)) print(tmp//2)