#include #define repi(i,a,b) for(int i=(a);i<(b);++i) typedef long long ll; int main() { ll N; std::cin >> N; ll ans = (N-2015)/400*57; repi( y, 2015, (N-2015)%400+2015 ) if( (y+y/4-y/100+y/400+(13*7+8)/5+23)%7 == 3 ) ++ans; std::cout << ans << std::endl; return 0; }