void HalfInsertSort(int* a, int n){
for(int i=1;i<n;i++){
int temp = a[i];
int left = 0;
int right = i-1;
while(left<=right){
int mid = (left+right)/2;
if(temp<a[mid])right = mid-1;
else left = mid+1;
}
for(int j=i-1;j>=right+1;j--)
a[j+1] = a[j];
a[right+1] = temp;
}
}