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

int main() {
  	int N;
	cin >> N;
  
  int x = 0;
  
  for (int i = 1; i < N; i++) {
    int j = i % 3, k = i % 5;
    if (j != 0 && k != 0) {
    x += i; 
    }
  }
  cout << x << endl;
}
