n, m = gets.split.map(&:to_i)
edges = []
m.times { edges << gets.split.map(&:to_i).map(&:pred) }
cards = Array.new(n, false)
count = 0

edges.each do |left, right|
  if cards[left] == false && cards[right] == false
    cards[left] = true
    cards[right] = true
    count += 1
  else
    cards[left] = true
    cards[right] = true
  end
end
puts count + cards.count(false)
