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

int main() {
 int n;
 cin >> n;
 long int sum = 0;
 while (n > 0)
 {
     if(n % 3 == 0 || N % 5 == 0){
         sum += 0;
     }
     else sum += n;
     n--;
 }
 cout << sum << endl;
 }

  

  
