Find pivot index of sorted array