from collections import deque n,m = map(int, input().split()) g = [[] for _ in range(2*n)] for _ in range(m): a,b = map(int, input().split()) a,b = a-1,b-1 g[a].append(b) g[b].append(a) c = [-1 for _ in range(2*n)] cnow = 0 for i in range(2*n): if(c[i]!=-1): continue c[i] = cnow d = deque([i]) while(d): now = d.pop() for v in g[now]: if(c[v]==-1): d.append(v) c[v] = cnow cnow+=1 count = [0 for _ in range(cnow)] for i in c: count[i]+=1 for i in range(cnow): count[i]%=2 ans = sum(count)//2 print(ans)