#include <stdio.h>

#define MAX_N 246912

int isPrime[ MAX_N + 1 ], pNum[ MAX_N + 1 ] = { 0, 0 };

int main( void ) {
	int i, j, n;

	isPrime[ 1 ] = 0;
	for ( i = 2; i <= MAX_N; i++ )
		isPrime[ i ] = 1;

	for ( i = 2; i <= MAX_N; i++ ) {
		pNum[ i ] = pNum[ i - 1 ] + isPrime[ i ];

		if ( isPrime[ i ] )
			for ( j = i * 2; j <= MAX_N; j += i )
				isPrime[ j ] = 0;
	}

	for ( ; scanf( "%d", &n ), n; printf( "%d\n", pNum[ n * 2 ] - pNum[ n ] ) ) ;

	return 0;
}