#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k[100005],l[100005];
  cin>>a>>b;
  vector<bool>v(a,false);
  vector<int>many(a,1);
  v[0]=true;
  for(int i=0;i<b;++i){
    cin>>k[i]>>l[i]; 
    if(v[k[i]-1])v[l[i]-1]=true;
    many[k[i]-1]--;
    many[l[i]-1]++;
    if(many[k[i]-1]==0)v[k[i]-1]=false;
  }
  int ans=0;
  for(int i=0;i<a;++i){
    if(v[i])ans++;
  }
  cout<<ans<<endl;
}