public static void main(String[] args) throws IOException {
        BufferedReader bInputStream = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(bInputStream.readLine().trim());
        int[][] mSquare = new int[n][n];
        for (int i = 0; i < n; i++) {
            String[] arr = bInputStream.readLine().trim().split(" ");
            for (int j = 0; j < n; j++) {
                mSquare[i][j] = Integer.parseInt(arr[j]);
            }
        }
        if (isMagicSquare(mSquare)) {
            System.out.println("0");
        } else {
            calculateMagicSums(mSquare);
            int count = 0;
            StringBuffer sb = new StringBuffer();
            for (int i = sumOfCols.length - 1; i >= 0; i--) {
                if (sumOfCols[i] != sumOfPrimaryDiag) {
                    sb.append("-" + (i + 1));
                    sb.append("\n");
                    count++;
                }
            }
            if (sumOfSecDiag != sumOfPrimaryDiag) {
                sb.append("0");
                sb.append("\n");
                count++;
            }
            for (int i = 0; i < sumOfRows.length; i++) {
                if (sumOfRows[i] != sumOfPrimaryDiag) {
                    sb.append(i + 1);
                    sb.append("\n");
                    count++;
                }
            }
            System.out.println(count);
            System.out.println(sb.toString());
        }
        System.exit(0);
    }