public static int search(int[] A, int t) {
		for (int n=A.length, l=0,r=n-1;l<=r;) {
			int mid=l+(r-l)/2;
			if (A[mid]==t) return mid;
			else if (A[l]<=A[mid]) {
				if (A[l]<=t&&t<A[mid]) r=mid-1;
				else l=mid+1;
			} else {
				if (A[mid]<t&&t<=A[r]) l=mid+1;
				else r=mid-1;
			}
		}
		return -1;
	}