#include <stdio.h>
#include <math.h>
int IsPrime(int n)
{
int i;
int m = sqrt(n);
for(i = 2; i <= m; i++)
{
if(n % i == 0)
{
return 0;
}
}
return 1;
}
int main()
{
int x, i = 0;
while(scanf("%d", &x) != EOF)
{
if(x == 0)
{
break;
}
int prime = 0;
if(!IsPrime(x))
{
for(i = 2; i <= sqrt(x); i++)
{
if(x % i == 0)
{
x = x / i;
i--;
}
if(IsPrime(x))
{
break;
}
}
prime = x;
}
else
{
prime = x;
}
int m;
int count = 0;
for(m = 2; m <= prime; m++)
{
if(IsPrime(m))
{
count++;
}
}
printf("%d\n", count);
}
return 0;
}
#include <math.h>
int IsPrime(int n)
{
int i;
int m = sqrt(n);
for(i = 2; i <= m; i++)
{
if(n % i == 0)
{
return 0;
}
}
return 1;
}
int main()
{
int x, i = 0;
while(scanf("%d", &x) != EOF)
{
if(x == 0)
{
break;
}
int prime = 0;
if(!IsPrime(x))
{
for(i = 2; i <= sqrt(x); i++)
{
if(x % i == 0)
{
x = x / i;
i--;
}
if(IsPrime(x))
{
break;
}
}
prime = x;
}
else
{
prime = x;
}
int m;
int count = 0;
for(m = 2; m <= prime; m++)
{
if(IsPrime(m))
{
count++;
}
}
printf("%d\n", count);
}
return 0;
}