#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define REP(i,n) FOR(i,0,n) #define each(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define exist(s,e) ((s).find(e)!=(s).end()) #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #define deb(x) cerr << #x << " = " << (x) << " , "; #define debl cerr << " (L" << __LINE__ << ")"<< endl; #define sz(s) (int)((s).size()) #define clr(a) memset((a),0,sizeof(a)) #define nclr(a) memset((a),-1,sizeof(a)) #define pb push_back #define INRANGE(x,s,e) ((s)<=(x) && (x)<(e)) #define MP(x,y) make_pair((x),(y)) double pi=3.14159265358979323846; using namespace std; typedef long long ll; typedef pair pii; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vvl; typedef vector vd; typedef vector vvd; typedef vector vs; template std::ostream& operator<<(std::ostream& os, const vector& z){ os << "[ "; REP(i,z.size())os << z[i] << ", " ; return ( os << "]" << endl); } template std::ostream& operator<<(std::ostream& os, const set& z){ os << "set( "; EACH(p,z)os << (*p) << ", " ; return ( os << ")" << endl); } template std::ostream& operator<<(std::ostream& os, const map& z){ os << "{ "; EACH(p,z)os << (p->first) << ": " << (p->second) << ", " ; return ( os << "}" << endl); } template std::ostream& operator<<(std::ostream& os, const pair& z){ return ( os << "(" << z.first << ", " << z.second << ",)" ); } double get_time(){ struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec + tv.tv_usec*1e-6; } typedef unsigned int uint32_t; struct RND{ uint32_t x; uint32_t y; uint32_t z; uint32_t w; RND(){ x=123456789; y=362436069; z=521288629; w=88675123; } void init(int seed){ x=123456789; y=362436069; z=521288629; w=seed+100; REP(i,10)get(); } uint32_t get(){ uint32_t t; t=x^(x<<11); x=y;y=z;z=w; w=(w^(w>>19))^(t^(t>>8)); return w; } }; RND rnd; void _main(istream &inp){ ll n; inp >> n; ll m = 0; ll ans = 0; ll D = (n-2015)/2800; D = 0; n -= D*2800; ans += D*399; for(ll k=2015; k<=n; k++){ if(k%400==0){ m += 365+1; } else if(k%100==0){ m+=365; } else if(k%4==0){ m+=365+1; } else{ m+=365; } ans += (m%7==0); } cout << ans << endl; } int main(){ if(0){ ifstream ifs("test.txt"); _main(ifs); } else{ _main(cin); } return 0; }