include [HTML_REMOVED]
include [HTML_REMOVED]
long long MAC ( std::vector[HTML_REMOVED] &arr, std::vector[HTML_REMOVED] &tmp , int left , int mid , int right ) {
int i = left, j = mid + 1, k = left;
long long cnt = 0;
while ( i <= mid && j <= right ) {
if ( arr[i] <= arr[j] ) {
tmp[k ] = arr[i];
}
else {
tmp[k] = arr[j];
cnt += ( mid - i + 1);
}
}
while ( i <= mid ) {
tmp[k++] = arr[i++];
}
while ( j <= right ) {
tmp[k++] = arr[j ++];
}
for ( i = left ; i <= right ;i ++ ) {
arr[i] = tmp[i];
}
return cnt;
}
long long MSAC ( std::vector[HTML_REMOVED] &arr, std::vector[HTML_REMOVED] &tmp , int left, int right ) {
long long cnt = 0;
if ( left < right ) {
int mid = left + ( right - left ) / 2;
cnt += MSAC (arr, tmp , left , mid );
cnt += MSAC (arr, tmp , mid + 1, right );
cnt += MAC ( arr, tmp , left, mid , right );
}
return cnt;
}
int main ()
{
int n;
std::cin >> n;
std::vector[HTML_REMOVED] arr (n);
std::vector[HTML_REMOVED] tmp(n);
for ( int i = 0; i < n ; i ++ ) {
std::cin >> arr[i];
}
std::cout << MSAC ( arr , tmp , 0 , n -1 ) ;
return 0;
}