public static void modifyArrayInPlace(int[]A) {
		int n=A.length;
		for(int i=0;i<n;++i) {
			if (A[i]<0) continue;
			for (int k=i,tmp=k,j=A[tmp];;k=j,j=tmp) {
				if (A[j]<0) {
					if (A[k]>=0)A[k]-=n;
					break;
				}
				swap(A, k, j);
				tmp=A[k];
				A[k]-=n;
			}
		}
		for (int i=0;i<n;++i) A[i]+=n;
	}