fn main() { let (n, m): (usize, usize) = { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), ) }; let mut indeg:Vec=vec![0;n+1]; for _ in 0..m{ let (a, b): (usize, usize) = { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), ) }; indeg[b]+=1; } let mut ans=0; for i in 1..n+1{ if indeg[i]==0{ ans+=1; } } println!("{}",ans); }