import java.util.*; class Yukico87 { public static void main(String[] args) { Scanner stdio = new Scanner(System.in); long n = stdio.nextLong(); long y = 2015; long a = (n-y); long ans =0; long[] memo = new long[400]; int wed = zeller(23,7,14,20); int j =20; int k =15; for(int i=0; i<400; i++) { if(wed == zeller(23, 7, k, j)) { ans++; } k++; if(k==100) { k=0; j++; } memo[i] = ans; } ans = ans*(a/400); a = a%400; ans = ans + memo[(int)a]; System.out.println(ans); } public static int zeller(int q, int m, int k, int j) { return ((q+(((m+1)*26)/10)+k+(k/4)+(j/4) - 2*j)%7); } }