#include <stdio.h>

int main(void){

        int i,n;
        long int sum = 0;

        scanf("%d",&n);

        for(i=1;i<=n;i++){
                if(i%3 == 0){ 
                        sum += 0;
                }else if(i%5 == 0){ 
                        sum += 0;
                }else{
                        sum += i;
                }   
        }   
        printf("%ld\n",sum);
return 0;
}
