long n;main(s){scanf("%ld",&n);for(;n;)s+=n>=400?n-=400,57:(n+n/4-n/100)%7==3;n=!printf("%d",s-289);}