Function to implement merge sort
void mergeSort ( vector < int > & v , int left , int right , int & inversions ) { if ( left < right ) { int mid = ( left + right ) / 2 ; mergeSort ( v , left , mid , inversions ) ; mergeSort ( v , mid + 1 , right , inversions ) ; merge ( v , left , mid , right , inversions ) ; } }