#!/usr/bin/python from datetime import datetime from itertools import count n = int(raw_input()) yy = 2014 md = 7, 23 x = datetime(yy, *md).weekday() arr = [] for y in count(yy+1): d = datetime(y, *md).weekday() arr.append(d) if (y - yy) % 400 == 0 and d == x: break sz = len(arr) p, q = divmod(n-yy, sz) res = arr.count(x) * p + arr[:q].count(x) print res