N, M = map(int, input().split()) G = [ [] for _ in range(N+1)] for _ in range(M): u, v = map(int, input().split()) G[u].append(v) odd = 0 even = 0 for val in G: if len(val) % 2 != 0: odd += 1 else: even += 1 if odd > 2: print(odd - 2) elif odd == 1: print(1) else: print(0)