#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 PII; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define CLEAR(d) memset((d), 0, (sizeof((d)))) #define ALL(c) (c).begin(), (c).end() #define ABS(x) ((x < 0) ? -(x) : (x)) #define SORT(x) sort((x).begin(), (x).end()) #define RSORT(x) sort((x).begin(), (x).end(), greater() ) #define SIZE(a) ((int)((a).size())) #define MOD 1000000007 #define EPS 1e-10 #define PI (acos(-1)) #define INF 10000000 struct edge { int to; int cost; }; //=================================================== bool is_uruu(ll y) { return (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? true : false; } int main() { ll n, ans = 0; int d = 1, t = 1, cyc = 0; cin >> n; for (int i = 2015; i <= min(n, 2415LL); i++) { cyc += (t == 0) ? 1 : 0; t += (is_uruu(i)) ? 2 : 1; t %= 7; } if (n > 2415) { ans += cyc * ((n - 2415) / 400 + 1); for (ll i = 2415 + ((n - 2415) / 400) * 400; i <= n; i++) { ans += (t == 0) ? 1 : 0; t += (is_uruu(i)) ? 2 : 1; t %= 7; } } else { ans = cyc; } cout << ans << endl; return 0; }