#include <stdio.h>
int main(void)
{
  	int N=0,n1=0;
  	int sum=0,plus=0;
  	scanf("%d",&N);
  
  	while(n1<=N){
    sum=sum+n1
    if(n1/15==0){
    sum=sum-n1;
    n1++;
    }else if(n1/3==0){
    sum=sum-n1;
    n1++;
    }else if(n1/5==0){
    sum=sum-n1;
    n1++;
    }else{
    n1++;
    }
    }
  
  	puts("%d",&sum)
  
  	return 0;
  
}
