import java.util.ArrayList; import java.util.Scanner; public class Bitsugoroku { static int N; static boolean tof = false; static ArrayList list = new ArrayList<>(); public static void main(String[] args) { Scanner s = new Scanner(System.in); int p = 1,count = 1; N = s.nextInt(); s.close(); if(N == 1){ count = 1; }else{ int h = Sugo(p,count); if(h == 0){ count = 0; }else{ count += h; } } if(count == 0){ System.out.println(-1); }else{ System.out.println(count); } } static int Sugo(int p,int count){ int d = Integer.bitCount(p); if(list.contains(p)){ return 0; } list.add(p); if(p + d > N){ System.out.println(">\t"+d); tof = true; int k = Sugo(p - d,count); if(k == 0){ count = 0; }else{ count += k; } }else if(p + d == N){ System.out.println("==\t"+d); count = 1; }else{ System.out.println("else\t"+d); int ph = Sugo(p+d,count); if(ph>0){ count += ph; }else{ int nh = Sugo(p+d,count); if(nh > 0){ count += nh; }else{ count = 0; } } } return count; } }