#include int main(void){ long long int n,h,J,K,ans=0; long long int th, y = 2014, m = 7, d = 23; J = y/100; K = y%100; h = (d + ((m+1)*26/10) + K + (K/4) + (J/4) + 5*J)%7; scanf("%lld", &n); for(y=2015;y<=n;y++){ J = y/100; K = y%100; th = (d + ((m+1)*26/10) + K + (K/4) + (J/4) + 5*J)%7; if(h == th){ ans++; } } printf("%lld\n", ans); return 0; }