import java.util.Scanner; public class Exercises16{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int goal = sc.nextInt(); int carol = 1; int bitCount = 0; int count = 1; if (goal % 4 == 0){ System.out.println(-1); return; } while (carol != goal){ bitCount = 0; int carolPresent = carol; while (carolPresent != 0){ if (carolPresent % 2 == 1){ bitCount++; } carolPresent /= 2; } if (carol + bitCount > goal){ carol -= bitCount; }else{ carol += bitCount; } count += 1; } System.out.println(count); } }