#include<stdio.h>

int main(){
	int N;

	scanf("%d",&N);

	int a[N];

	int temp;
	int sum = 0;
	int i;
	for(i=0;i<N;i++){
		temp = i+1;
		if(temp % 3 == 0){
			temp = 0;
		}else if(temp % 5 == 0){
			temp = 0;
		}

		a[i] = temp;
		sum = a[i]

	}

	printf("%d",sum);


	return 0;
}