#include <bits/stdc++.h>
#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)

typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;



int main() {

  ll n;
  cin >> n;
  ll sum=0;
  REP1(i,n){
    bool flag = true;
    if(i%3==0||i%5==0){
      flag = false;
    }
    if(flag){
      sum += i;
    }
  }
  cout << sum << endl;
}