include<stdio.h>
int main(void){
int a=0;
int b=0;
int c=0;
int d=0;
int e=0;
int f=0;
int g=0;
int h=0;
int i=0;

scanf("%d",$a);
b = a*(a-1)/2;
c = a/3;
d = a/5;
e = a/15;

f = 3*c*(c-1)/2;
g = 5*d*(d-1)/2;
h = 15*e*(e-1)/2;

i = b-f-g+h;
printf("%d",i);
}