#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int N=0,count=0;
  scanf("%d",&N);
  int aInt[N];
  for (int i=0;i<N;i++){
    aInt[i] = i+1;
    if (!(aInt[i]%3==0 || aInt[i]%5==0)){
       count += aInt[i];
    }
  }
  printf("%d",count);
  return 0;
}