#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
 	cin >> N;
	
    cout << 0.5 * N * (N + 1) - 0.5 * (N / 3) * (N / 3 * 3 + 3) - 0.5 * (N / 5) * (N / 5 * 5 + 5) + 0.5 * (N / 15) * (N / 15 + 15) << endl;
}