#include using namespace std; int main() { int N, M; cin >> N >> M; vector in( N ); for( int i = 0; i < M; i++ ) { int A, B; cin >> A >> B; B--; in[B]++; } int ans = 0; for( int i = 0; i < N; i++ ) { if( in[i] == 0 ) ans++; } cout << ans << endl; }