#include #include #include using namespace std; typedef long long LL; bool is_uruu(LL year) { return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); } LL solve(LL N) { LL ans = 0; LL year; int w = 0; for (year = 2015; year <= N && year < 400 * 7; ++year) { int days = 365 + is_uruu(year); w = (w + days) % 7; ans += w == 0; } LL a = max(0LL, N / (400 * 7) - 1); ans += a * 400; year += a * 400 * 7; for (; year <= N; ++year) { int days = 365 + is_uruu(year); w = (w + days) % 7; ans += w == 0; } return ans; } int main(int argc, char *argv[]) { string s; getline(cin, s); LL N; sscanf(s.c_str(), "%lld", &N); cout << solve(N) << endl; return 0; }