#include<iostream>#include<cstring>#include<vector>#include<stdio.h>#include<queue>#include<math.h>#include<stack>#include<math.h>#include<algorithm>#include<map>#include<set>#include<iostream>
using namespace std;#define MAX 99999999typedeflonglong ll;int n,m;int a[100001];//盒子中球的个数int red[100001];//表示该号球可能有红球,1为可能,0为不可能intmain(){
cin>>n>>m;int cnt =0;
red[1]=1;for(int i =1; i <= n;i++)
a[i]=1;for(int i =0; i < m ;i++){
int x,y;
cin>>x>>y;if(red[x]&& a[x]==1){
red[x]=0;
red[y]=1;}elseif(red[x]&& a[x]>1)
red[y]=1;
a[x]--;
a[y]++;}for(int i =1; i <= n;i++)if(red[i])
cnt++;
cout<<cnt;return0;}