#include <bits/stdc++.h>
using namespace std;
const long long MaxN = 2e5 + 10;
long long a[MaxN];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long Ans = 0;
  vector<long long> V;
  V.clear();
  for (long long i = 1; i <= n; i++) {
    sort(V.begin(), V.end());
    Ans += (V.size() - (upper_bound(V.begin(), V.end(), a[i]) - V.begin()));
    V.push_back(a[i]);
  }
  cout << Ans << endl;
  return 0;
}
