n, m = gets.chomp.split.map(&:to_i)
parent = (0...n).to_a
m.times{
    a, b = gets.chomp.split.map{|x| x.to_i - 1}
    pa = a
    pa = parent[pa] while pa != parent[pa]
    pb = b
    pb = parent[pb] while pb != parent[pb]
    x, y = [pa, pb].minmax
    parent[y] = x
}
n.times{|a|
    pa = a
    pa = parent[pa] while pa != parent[pa]
    parent[a] = pa    
}
h = Hash.new(0)
parent.each{|p| h[p] += 1}
shi = mura = 0
h.each{|k, v|
    if v == 1
        mura += 1
    else
        shi += 1
    end
}
puts (shi - mura).abs
