import java.util.Scanner;

/**
 * HJ56 完全数计算 - 简单
 */
public class HJ056 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str = sc.nextLine();
            int n = Integer.parseInt(str);
            int result = 0;
            if (n < 6) {
                result = 0;
            } else if (n < 28) {
                result = 1;
            } else if (n < 496) {
                result = 2;
            } else if (n < 8128) {
                result = 3;
            } else if (n < 33550336) {
                result = 4;
            }
            System.out.println(result);
        }
        sc.close();
    }
}