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) p = [uf.find(x) for x in range(2*n+1)] c = Counter(p[1:]) ans = 0 for v in c.values(): if v % 2 == 1: ans += 1 print(ans//2) if __name__ == "__main__": main()