#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

int MOD=1000000007;

int main(){
  ll N,sum=0;
  cin >> N;
  for(ll i=1; i<=N; i++){
    if(i%3==0 || i%5==0)
    sum+=0;
    else
    sum+=i;
  }
  cout << sum << endl;

}
