import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n, m;
	{
		int[] tmp = readln.chomp.split.map!(to!int).array;
		n = tmp[0], m = tmp[1];
		}
	
	bool flag[] = new bool[n];
	flag[0] = 1;
	int count[] = new int[n];
	count.fill(1);
	
	foreach(i; 0 .. m){
		int[] tmp = readln.chomp.split.map!(to!int).array;
		int x = tmp[0] - 1, y = tmp[1] - 1;
		
		count[x] -= 1, count[y] += 1;
		if(flag[x]) flag[y] = 1;
		if(count[x] == 0) flag[x] = 0;
		}
	
	int ans = 0;
	foreach(i; 0 .. n){
		if(flag[i]) ans += 1;
		}
	
	ans.writeln;
	
	}
	