#include <stdio.h>

int main (){
  long int N,Fizz=0, Buzz=0, FizzBuzz = 0, sum = 0;
  scanf("%d",&N);
  Fizz = 1.5 *(N/3)*(N/3 + 1);
  Buzz = 2.5 * (N/5)*(N/5 + 1);
  FizzBuzz = 7.5 * (N/15) * (N/15 + 1);
  sum = 0.5*N*(N+1)-Fizz-Buzz+FizzBuzz;
  printf("%d",sum);
  return 0;
}
