//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>
using namespace std;

#define ll long long

void solve()
{
    ll N;
    cin >> N;
    ll count = 0;
    for (ll i = 1; i <= N; i++)
    {
        if (i % 3 == 0 || i % 5 == 0)
        {
            count += 0;
        }
        else
        {
            count += i;
        }
    }

    cout << count << endl;

    return;
}

int main()
{
    solve();
    return 0;
}
