#include<stdio.h>
 
int main(void)
{
  int n,i;
  long count=0;
  
  scanf("%d",&n);
  
  for(i=-1;i<n;i++){
    if(i%3==0||i%5==0)
		count+=0;
    else
        count= count+i;
  }
  
  printf("%ld\n",count);
  
  return 0;
}