#include #include #include #include #include using namespace std; int mysquare[3][3]; int squares[4][3][3] = { { {4,9,2}, {3,5,7}, {8,1,6} }, { {2,9,4}, {7,5,3}, {6,1,8} }, { {2,7,6}, {9,5,1}, {4,3,8} }, { {4,3,8}, {9,5,1}, {2,7,6} } }; int main() { for(int i = 0; i < 3; i++){ for(int j = 0; j < 3; j++){ scanf("%d", &mysquare[j][i]); } } int min = 1000000; for(int i = 0; i < 4; i++){ int count = 0; for(int j = 0; j < 3; j++){ for(int k = 0; k < 3; k++){ count+=abs(squares[i][j][k]-mysquare[j][k]); } } if(count