import sys sys.setrecursionlimit(1000000) n, m = map(int, input().split()) relation = [[] for _ in range(2*n)] visited = [False]*(2*n) unknown = 0 for _ in range(m): a, b = map(int, input().split()) a -= 1; b -= 1 relation[a].append(b) relation[b].append(a) def dfs(n: int, sum): visited[n] = True check = True for v in relation[i]: if not visited[v]: check = False return 1 + dfs(v, sum) if check: return 1 for i in range(2*n): if not visited[i]: len_of_group_member = dfs(i, 0) unknown += len_of_group_member % 2 print(unknown // 2)