#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  int ans=0;
  rep(i,n){
    int y=i+1;
    if(y%3==0||y%5==0)continue;
    else ans+=y;
  }
  cout << ans << endl;
}
