#include <stdio.h>
#include <stdlib.h>

int judge(int a)
{
	int sum = 0;

	if (a%3==0 && a%5==0)
	{
		//printf("FizzBuzz\n");
	}
	else if(a%3==0)
	{
		//printf("Fizz\n");
	}
	else if(a%5==0)
	{
		//printf("Buzz\n");
	}
	else
		sum = a;

	return (sum);
}

int main(void)
{
	char buf[256];
	char *str;
	int a = 0;
	long sum = 0;
	int i = 0;

	if (scanf("%255s", buf) != 1)
	{
		return 1;
	};
	str = buf;
	a = atoi(buf);

	while (i <= a)
	{
		sum += judge(i);
		i++;
	}
	printf("%ld\n", sum);

	return (0);
}