#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, cnt, a[maxn], b[maxn];
void merge_sort(int x, int y) {
  if (y - x > 1) {
    int m = x + (y - x) / 2;
    merge_sort(x, m), merge_sort(m, y);
    int p = x, q = m, i = x;
    while (p < m || q < y) {
      if (q == y || (p < m && a[p] <= a[q]))
        b[i++] = a[p++];
      else
        b[i++] = a[q++], cnt += m - p;
    }
    for (i = x; i < y; i++) a[i] = b[i];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  merge_sort(0, n);
  printf("%d", cnt);
  return 0;
}
