include[HTML_REMOVED]
using namespace std;
const int N = 1e6 + 10;
long m;
long q[N], t[N];
void merge_sort(long q[], int l, int r)
{
if (l >= r) return;
int mid = (l + r) >> 1;int i = l, j = mid + 1, k = 0;
merge_sort(q, l, mid);
merge_sort(q, mid + 1, r);
while (i <= mid && j <= r)
{
if (q[i] < q[j])t[k++] = q[i++];
else {
t[k++] = q[j++];
m += (mid - i + 1);
}
}
while (i <= mid)t[k++] = q[i++];
while (j <= r)t[k++] = q[j++];
for (int p = 0, pp = l; pp <= r; pp++, p++)
q[pp] = t[p];
}
int main()
{
int y;
cin >> y;
for (int p = 0; p < y; p++)
scanf(“%ld”, &q[p]);
merge_sort(q, 0, y - 1);
cout << m;
return 0;
}