import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] felm = new long[]{3, 5, 17, 257, 65537};
        long[] probable = new long[1 << 5];
        for (int i = 0; i < (1 << 5); i++) {
            int x = i;
            probable[i] = 1;
            for (int j = 0; j < 5; j++) {
                if (x % 2 == 1) {
                    probable[i] *= felm[j];
                }
                x /= 2;
            }
        }
        int count = 0;
        for (long x : probable) {
            long y = x;
            while (y <= n) {
                count++;
                y *= 2;
            }
        }
        System.out.println(count - 2);
    }
}