public int totalNQueens(int n) {
        char[][] board = new char[n][n];
        int[] occupy = new int[n];
        Arrays.fill(occupy, -1);
        for (char[] c : board) {
            Arrays.fill(c, '.');
        }
        dfs(board, occupy, 0);
        return count;
    }