public static void generateNQueens(int[] position,int insertN,int n) {
        for (int i=0;i<n;i++){
            position[insertN-1] = i;
            boolean satis = true;
            for (int j=0;j<insertN-1;j++){
                if(insertN-1-j==position[insertN-1]-position[j]||insertN-1-j==position[j]-position[insertN-1]||
                    position[insertN-1]==position[j]){
                    satis = false;
                    continue;
                }
            }
            if(satis){
                if(insertN == n){
                    result++;
                    return;
                }
                else {
                    generateNQueens( position,insertN+1,n);
                }
            }
        }
    }