static public void Main()
        {
            int source = int.Parse(Console.ReadLine()); // price of chocolate
            int dest   = int.Parse(Console.ReadLine()); // number of wrapers per chocolate

            ChessCell source_cc = GetChessMapping(source);
            ChessCell dest_cc   = GetChessMapping(dest);

            Console.WriteLine(GetMovesCount(source_cc, dest_cc));
        }
 static int GetMovesCount(ChessCell s, ChessCell d)
 {
     if (s.row == d.row && s.col== d.col)
         return 0;
     // white can't reach black and black can't white
     if ((s.row + s.col) % 2 != (d.row + d.col) % 2)
         return -1;
     // d1
     if (d.row - s.row == d.col - s.col)
         return 1;
     // d2
     if (d.row - s.row == s.col-d.col)
         return 1;
     return 2;
 }
 static int GetMovesCount(ChessCell s, ChessCell d)
 {
     if (s.row == d.row && s.col == d.col)
     {
         return(0);
     }
     // white can't reach black and black can't white
     if ((s.row + s.col) % 2 != (d.row + d.col) % 2)
     {
         return(-1);
     }
     // d1
     if (d.row - s.row == d.col - s.col)
     {
         return(1);
     }
     // d2
     if (d.row - s.row == s.col - d.col)
     {
         return(1);
     }
     return(2);
 }