#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-9; bool is_uruu(ll y) { if (y % 400 == 0) return true; if (y % 100 == 0) return false; if (y % 4 == 0) return true; return false; } int main() { vector< vector > a(400, vector(7, -1)); ll N; cin >> N; int x = 0; ll cnt = 0; for (ll y = 2014; y <= N;) { if (y + 400 <= N) { y += 400; cnt += 57; } if (x == 0) cnt++; x += (is_uruu(y + 1) ? 2 : 1); x %= 7; y++; } cout << cnt - 1 << endl; }