int searchRight(int[] A, int target, int pos, int l, int r) {

		if (l >= r) {
			if (A[l] == target)
				pos = l;
			return pos;
		} else {
			int mid = (l + r) / 2;
			if (A[mid] < target) {
				return searchRight(A, target, pos, mid + 1, r);
			} else if (A[mid] > target) {
				return searchRight(A, target, pos, l, mid - 1);
			} else {
				pos = mid;
				return searchRight(A, target, pos, mid + 1, r);
			}
		}
	}