#include <stdio.h>

int main(void){
  unsigned int N;
  unsigned int sum=0;
  scanf("%d", &N);
  unsigned int i;
  for(i=1;i<=N;i++){
    if(i%3==0||i%5==0) continue;
    else sum+=i;
  }
  
  printf("%d", sum);
  
  return 0;
}