from collections import Counter class UnionFind(): def __init__(self,n): self.parents = list(range(n)) def find(self, x): if self.parents[x] == x: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): px = self.find(x) py = self.find(y) if px != py: self.parents[px] = py def main(): n,m=map(int,input().split()) uf = UnionFind(2*n+1) for i in range(m): a,b=map(int,input().split()) uf.union(a,b) c = Counter(uf.parents[1:]) ans = 0 for v in c.values(): if v % 2 == 1: ans += 1 print(ans//2) if __name__ == "__main__": main()