import sequtils, strutils proc root(x: int, p: var seq[int]): int = if p[x] == -1: x else: p[x] = root(p[x], p) return p[x] proc unite(x, y: int; p, rank, size: var seq[int]) = var rx = root(x, p) ry = root(y, p) if rank[rx] < rank[ry]: swap(rx, ry) p[ry] = rx if rank[rx] == rank[ry]: inc rank[rx] size[rx].inc size[ry] var n, m: int (n, m) = stdin.readLine.split.map parseInt let ab = m.newSeqWith stdin.readLine.split.map parseInt var p = (-1).repeat n * 2 rank, size = 1.repeat n * 2 for v in ab: var a = pred v[0] b = pred v[1] ra = root(a, p) rb = root(b, p) if ra != rb: unite(a, b, p, rank, size) var list: seq[int] for i, v in p: if v == -1: list.add i var cnt = 0 for idx in list: if size[idx] mod 2 == 1: inc cnt echo cnt div 2