import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long ans = -1; for(long i = 3; i <= 6; i++) { if(i != 4) { long t = n - i; int p = 0; while(t % 2 == 0) { t /= 2; if(t % 2 == 1) p++; } if(p > 0) { ans = i; break; } } } System.out.println(ans); } }