
#include <stdio.h>

int FizzBuzz(int N)
{
	if (N % 3 == 0 || N % 5 == 0)
		return 0;

	return N;
}

int main()
{
	int N;
	scanf("%d", &N);

	long long int Result = 0;
	for (int n = 0; n < N; n++)
		Result += FizzBuzz(n);
	
	printf("%lld", Result);

	return 0;
}





