class UnionFind: def __init__(self, n) -> None: self.par = [-1]*(n + 1) self.size = [1]*(n + 1) def root(self, x): if self.par[x] == -1: return x else: self.par[x] = self.root(self.par[x]) return self.par[x] def issame(self, x, y): return self.root(x) == self.root(y) def unite(self, x, y): x = self.root(x) y = self.root(y) # 既に同じグループなら何もしない if x == y: return False # unionbysize if self.size[x] < self.size[y]: x, y = y, x self.par[y] = x self.size[x] += self.size[y] return True def issize(self, x): return self.size[self.root(x)] N, M = map(int, input().split()) UF = UnionFind(2*N) for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 UF.unite(a, b) C = 0 for i in range(2*N): if i == UF.root(i): C += 1 if UF.issize(i) % 2 != 0 else 0 print(C//2)