#include<iostream>
#include <string>
#include<vector>

using namespace std;

int main(){
    
    int N;
    cin >> N;
    long int sum =0;
    for(int n=1;n<N;n++){
        int a=n;
        if(n%3==0){a=0;}
        if(n%5==0){a=0;}
        sum=sum+a;
    }

    cout << sum << endl;
    
}