import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); UnionFindTree uft = new UnionFindTree(n * 2); while (m-- > 0) { uft.unite(sc.nextInt() - 1, sc.nextInt() - 1); } int ans = 0; for (int x : uft.getCounts()) { ans += x % 2; } System.out.println(ans / 2); } static class UnionFindTree { int[] parents; int[] counts; public UnionFindTree(int size) { parents = IntStream.range(0, size).toArray(); counts = IntStream.range(0, size).map(i -> 1).toArray(); } public int find(int x) { return x == parents[x] ? x : (parents[x] = find(parents[x])); } public boolean same(int x, int y) { return find(x) == find(y); } public void unite(int x, int y) { int xx = find(x); int yy = find(y); if (xx != yy) { parents[xx] = yy; counts[yy] += counts[xx]; } } public List getCounts() { return IntStream.range(0, parents.length) .filter(i -> parents[i] == i) .map(i -> counts[i]) .boxed() .toList(); } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }