public class MissionImpossible {
public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
//int NUMBER_OF_PRIMES_PER_LINE=10;
int count = 0; // Count the number of prime numbers
int number = 2; // A number to be tested for primeness
//System.out.println("The first 50 prime numbers are \n");
// Repeatedly find prime numbers
while (number < N) {
// Assume the number is prime
boolean isPrime = true; // Is the current number prime?
// Test if number is prime
int divisor = 2;
while (divisor <= number / 2){
if (number % divisor == 0) { // If true, number is not prime
isPrime = false; // Set isPrime to false
break; // Exit the for loop
}
divisor++;
}
// Print the prime number and increase the count
if (isPrime) {
count++; // Increase the count
// if (count % NUMBER_OF_PRIMES_PER_LINE == 0) {
// Print the number and advance to the new line
// System.out.println(number);
//}
//else
//System.out.print(number + " ");
}
// Check if the next number is prime
number++;
}
System.out.print(count);
}
}