
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <math.h>

using namespace std;

int main(){

	int N,a[1000000];
	cin >> N;

	long long int ans = 0;
	for (int i = 0; i < N; i++) {
		if (i % 3 == 0 || i % 5 == 0) {
			a[i] = 0;
		}
		else a[i] = i;
		ans += a[i];
	}

	cout << ans << endl;

return 0;
}
