class UnionFind: def __init__( self, n: int, ) -> None: self.forest = [-1] * n def union(self, x: int, y: int) -> None: x = self.findRoot(x) y = self.findRoot(y) if x == y: return if self.forest[x] > self.forest[y]: x, y = y, x self.forest[x] += self.forest[y] self.forest[y] = x def findRoot(self, x: int) -> int: if self.forest[x] < 0: return x else: self.forest[x] = self.findRoot(self.forest[x]) return self.forest[x] def issame(self, x: int, y: int) -> bool: return self.findRoot(x) == self.findRoot(y) def size(self, x: int) -> int: return -self.forest[self.findRoot(x)] n, m = map(int, input().split()) ab = [tuple(map(int, input().split())) for _ in range(m)] uf = UnionFind(n * 2) for a, b in ab: uf.union(a - 1, b - 1) groups = [] for i in range(n * 2): if i == uf.findRoot(i): groups.append(uf.size(i)) ans = 0 for g in groups: ans += g % 2 print(ans // 2)