#include <stdio.h>
#define max 1000
int main()
{
   int i = 0, j;
   long a[max];
   while (scanf("%d", &a[i++]) != EOF);
   i--;
   for (j = 0; j < i; j++)
   {
      if (a[j] <= 2)
      {
         printf("-1\n");
      }
      else if (a[j] % 2 != 0)
      {
         printf("2\n");
      }
      else if (a[j] % 4 != 0)
      {
         printf("4\n");
      }
      else
      {
         printf("3\n");
      }
   }
   return 0;
}



京公网安备 11010502036488号