private static int sign(int [] a){
        int x=0;
        int len = a.length;
        for(int k=1; k<len; k++)
            if (a[k]> k ) x+=a[k]-k;
        x%=2;
        if (x==1) return -1;
        else return 1;
    }