#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<> typedef long long ll; using namespace std; const ll inf = 1e18+7; int main(){ ll N; cin >> N; ll day = 0; ll nokori = N - 2014; ll ans = 0; ll mul = nokori / 2800; ans += mul * 399; nokori %= 2800; REP(i, 0, nokori){ ll y = 2015 + i; if (y % 400 == 0) day += 366; else if (y % 100 == 0) day += 365; else if (y % 4 == 0) day += 366; else day += 365; if (day % 7 == 0) ans++; } p(ans); return 0; }