#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  ll n;
  cin>>n;
  ll sum=0;
  rep(i,n){
    sum+=i+1;
    if(i%3==0) ans-=i+1;
    if(i%5==0)  ans-=i+1;
    if(i%15==0)  ans+=i+1;
  }
  cout<<ans<<endl;
  
}