public static int findMin(int[] num) {
		int[]A=num;
		int n=A.length, l=0, r=n-1;
		while (true) {
			if (l==r) {
				return A[l];
			} else if (A[l]!=A[r]){
				if (A[l]<A[r])
					return A[l];
				else {
					int m=l+(r-l)/2;
					if (A[m]>=A[l]) 
						l=m+1;
					else {
						if (A[m-1]>A[m])
							return A[m];
						else r=m-1;
					}
				}
			} else {
				++l;
			}
		}
	}