#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  long answer = 0;
  
  for(int i = 0; i < n; i++) {
    int x = 0;
    x = i + 1;
    if(x % 3 == 0 || x % 5 == 0){
      //何もしない
    }
    else {
      answer += x;
    }
  }
  cout << answer << endl;
}