#include<stdio.h>
int main(void){
  int FizzBuzz;
  scanf("%d",&FizzBuzz);
  unsigned long sum=0;
  unsigned long i;
  for(i=1;i<=FizzBuzz;i++){
    if(i % 3 == 0 || i % 5 == 0){
      continue;
    }
    sum = sum + i;
  }
  printf("%d",sum);
  return 0;
}