#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define plint pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ll n,res=0;
    cin >> n;

    FOR(i,1,n+1){
        if((i%3==0) || (i%5==0)){
            res += 0;
        }else{
            res += i;
        }
    }
    cout << res << endl;
    return 0;
}