def dfs(pos): if pos in s or vis[pos]: return s.add(pos) vis[pos] = True for i in g[pos]: dfs(i) n,m = map(int,input().split()) g = [[] for _ in range(2*n)] for i in range(m): a,b = map(int,input().split()) a -= 1 b -= 1 g[a].append(b) g[b].append(a) cnt = 0 vis = [False]*(2*n) for i in range(2*n): s = set() if g[i] == []: cnt += 1 elif not vis[i]: dfs(i) cnt += len(s) % 2 print(cnt // 2)