import java.util.; import java.io.; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = null;

    while((str = in.readLine()) != null){
        int count = 0;
        int num = Integer.parseInt(str);
        for(int i = 2;i <= num;i++){
            int temp = (int)Math.pow(2,i)-1;
            if(is_prime(i) && is_prime(temp)){
                int m = (int)((Math.pow(2,i) -1 ) * Math.pow(2,i-1));
                if(m <= num) {
                    count ++;
                }else{
                    break;
                }
            }
        }
        System.out.println(count);
    }
    
}
public static boolean is_prime(int n){
    boolean flag = true;
    for(int i = 2;i <= Math.sqrt(n);i ++){
        if(n % i == 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

}