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

int main() {
  int n;
  cin >> n ;
  long long total = 0;
  for (int i = 0; i < n; i++) {
    if((i+1)%3!=0&&(i+1)%5!=0)
    {total += i+1;}
      
  }cout << total <<endl;
