import std.algorithm, std.array, std.container, std.range; import std.string, std.conv, std.bigint, std.math, std.random; import std.stdio, std.typecons; void main() { auto n = readln.chomp.to!long; auto ri = iota(2800).map!(y => calc(y)); auto c = ri.count!(r => r == ri[2014]); auto r = (n - 2015) / 2800 * c; auto m = (n - 2015) % 2800; if (m + 2015 < 2800) { r += ri[2015..m + 2015 + 1].count!(r => r == ri[2014]); } else { r += ri[2015..$].count!(r => r == ri[2014]); r += ri[0..m + 2015 - 2800 + 1].count!(r => r == ri[2014]); } writeln(r); } long calc(long y) { return (y + y / 4 - y / 100 + y / 400) % 7; }