#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<n;i++)
using namespace std;

int main(){
    long long N,sum = 0;
    bool Fizz,Buzz;

    cin >> N;

    rep(i,N){
        Fizz = false;
        Buzz = false;
        if(i % 3 == 0){
            Fizz = true;
        }else if(i % 5 == 0){
            Buzz = true;
        }else{
            sum += i;
        }
    }

    cout << sum;
}