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

using namespace std;

int main()
{
	long long N,SUM=0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		if ((i + 1) % 3 == 0 || (i + 1) % 5 == 0)SUM += 0;
		else SUM += i + 1;
	}
	cout << SUM << endl;
	return 0;
}