#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define MAX_C 1000000001


int main() {
  int n;
  cin >> n;
  ll s = 0;
  for (int i = 0; i < n; i++) {
    if ((i % 3) * (i % 5) != 0) s += i;
  }

  cout << s << endl;
}