class Euler53 {

    private static class Options {
        int nMax = 100;
        long threshold = 1000000;
        boolean runCheckpoints = true;
    }

    private static boolean parseIntAfterPrefix(String arg, String prefix, int[] value) {
        if (!arg.startsWith(prefix)) {
            return false;
        }
        String tail = arg.substring(prefix.length());
        if (tail.isEmpty()) {
            return false;
        }

        int parsed = 0;
        for (int i = 0; i < tail.length(); i++) {
            char c = tail.charAt(i);
            if (c < '0' || c > '9') {
                return false;
            }
            parsed = parsed * 10 + (c - '0');
        }
        value[0] = parsed;
        return true;
    }

    private static boolean parseLongAfterPrefix(String arg, String prefix, long[] value) {
        if (!arg.startsWith(prefix)) {
            return false;
        }
        String tail = arg.substring(prefix.length());
        if (tail.isEmpty()) {
            return false;
        }

        long parsed = 0;
        for (int i = 0; i < tail.length(); i++) {
            char c = tail.charAt(i);
            if (c < '0' || c > '9') {
                return false;
            }
            parsed = parsed * 10 + (c - '0');
        }
        value[0] = parsed;
        return true;
    }

    private static boolean parseArguments(String[] args, Options options) {
        for (String arg : args) {
            if (arg.equals("--skip-checkpoints")) {
                options.runCheckpoints = false;
                continue;
            }
            int[] intValue = {0};
            long[] longValue = {0};
            if (parseIntAfterPrefix(arg, "--n-max=", intValue)) {
                options.nMax = intValue[0];
                continue;
            }
            if (parseLongAfterPrefix(arg, "--threshold=", longValue)) {
                options.threshold = longValue[0];
                continue;
            }
            System.err.println("Unknown argument: " + arg);
            return false;
        }
        return options.nMax >= 1 && options.threshold >= 1;
    }

    private static int solve(int nMax, long threshold) {
        int count = 0;

        for (int n = 1; n <= nMax; n++) {
            long c = 1;
            for (int r = 1; r <= n / 2; r++) {
                c = (c * (n - r + 1)) / r;
                if (c > threshold) {
                    count += (n + 1) - 2 * r;
                    break;
                }
            }
        }

        return count;
    }

    private static boolean runCheckpoints() {
        if (solve(10, 10) != 25) {
            System.err.println("Checkpoint failed for n_max=10 threshold=10");
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        Options options = new Options();
        if (!parseArguments(args, options)) {
            System.exit(1);
        }
        if (options.runCheckpoints && !runCheckpoints()) {
            System.exit(2);
        }

        System.out.println(solve(options.nMax, options.threshold));
    }
}
