import java.util.*; public class Exercise37{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); long num = sc.nextLong(); long count = num / 15 * 16; long countNeeded = num % 15; for (long n = 1; n <= countNeeded; n++){ if (n % 3 == 0 && n % 5 == 0){ count += 4; }else if(n % 3 == 0){ count += 2; }else if(n % 5 == 0){ count += 2; } } System.out.println(count); } }