import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int A = sc.nextInt(); long[] f_prime = {3, 5, 17, 257, 65537}; HashSet set = new HashSet(); HashSet next = new HashSet(); for(long i = 1; i <= A; i *= 2){ set.add(i); } for(final long f_p : f_prime){ next.clear(); for(final long val : set){ if(val * f_p <= A){ next.add(val * f_p); } } next.addAll(set); { HashSet tmp = set; set = next; next = tmp; } } System.out.println(set.size() - 2); } }