// AOJ ALDS1_5_D The Number of Inversions
// 2018.4.30 bal4u

#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define MAX_N 200002
#define INF   0x7f7f7f7f

int a[MAX_N];
int w[MAX_N/2+2];

int number_of_inversions(int low, int high) 
{ 
	int i, j, k, p, mid;
	int ans = 0;

	if (low < high) {
		mid = (low + high) >> 1;
		ans += number_of_inversions(low,   mid);
		ans += number_of_inversions(mid+1, high);

		p = mid-low+1;
		memcpy(w, a+low, p << 2);
		i = mid+1, j = 0; k = low;

		w[p] = INF;
		while (i <= high) {
			if (w[j] <= a[i]) a[k++] = w[j++];
			else              a[k++] = a[i++], ans += i-k;
		}
		memcpy(a+k, w+j, (p-j) << 2);
	}
	return ans;
}

int main()
{
	int n, i;
	
	n = in(); for (i = 0; i < n; i++) a[i] = in();
	printf("%d\n", number_of_inversions(0, n-1));
	return 0;
}
