#include<iostream>
#include<cstdio>
using namespace std;
int n,m,ans;
int a[201010];
bool br[202020];
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i)
		a[i]=1;
	br[1]=1;
	int x,y;
	for (int i=1;i<=m;++i)
	{
		scanf("%d %d",&x,&y);
		if (br[x]) br[y]=1;
		--a[x]; ++a[y];
		if (a[x]==0) br[x]=0;
	}
	for (int i=1;i<=n;++i)
		if (br[i]) ++ans;
	printf("%d\n",ans);
	return 0;
}