#include using namespace std; enum DayOfWeek { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, }; int Zeller(int y, int m, int d) { if (m < 3) { y--; m += 12; } return (y + y / 4 - y / 100 + y / 400 + (13 * m + 8) / 5 + d) % 7; } int main() { DayOfWeek day_of_week_table[] = { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; long long n; cin >> n; long long num_of_years = n - 2015 + 1; long long count = 0; if (n >= 400) { for (int year = 1; year <= 400; year++) { if (day_of_week_table[Zeller(year, 7, 23)] == Wednesday) count++; } count *= num_of_years / 400; } for (int i = 0; i < num_of_years % 400; i++) { if (day_of_week_table[Zeller(2015 + i, 7, 23)] == Wednesday) count++; } cout << count << endl; return 0; }