#include<iostream>
using namespace std;

int main(){
    int n,ans;
    cin >> n;
    for (int i = 0; i < n; i++){
        int hako[n];
        hako[i] = i + 1;
    
        if(hako[i] % 3 == 0 && hako[i] % 5 == 0){
            hako[i] = 0;
        } else if(hako[i] % 3 == 0){
            hako[i] = 0;
        } else if(hako[i] % 5 == 0){
            hako[i] = 0;
        }

        ans += hako[i];
        }
    cout << ans << endl;
    return 0;
}