#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  ll ans = 0;
  ll N;
  cin>>N;
  for(int i = 1;i<=N;i++){
    if(N%3 != 0 && N%5 != 0){
      ans += i;
    }
  }
  cout << i << endl;
  return 0;
}