/**
 *    author:  orzvanh14 ( Độc cô cầu đặc )
 *    created: 18.04.2026 03:56:02
 *    too lazy to update time
**/
// i wants to take ioi
//binhtinhtutinkhongcaycunhungmotkhikhongcontutinnualatuyetvong
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define nn "\n"
#define pi pair<int, int>
#define ti tuple<int, int, int>
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define eb emplace_back
#define pb push_back
#define TASK " "

#define ms(a, x) memset(a, x, sizeof(a))
#define all(a) a.begin(), a.end()
#define All(a, n) a + 1, a + 1 + n

#define LOG 19

const int INF = 1e18;
const int N = 1e5 + 5;
const int maxn = 100 + 5;
const int mod = 1e9 + 7;


struct node{
	int kc, u;
	bool operator<(const node& other) const {
        return kc > other.kc; 
    }
};
struct edge{
	int v, w, h;
};
int n, a[N];
int kq = 0;
int bit[N];
void nhap(){
    cin >> n;
    for(int i = 1 ; i <= n; i++){
    	cin >> a[i];
    }
}
void update(int x, int val){
	for(; x < N; x += x&-x) bit[x] += val;
}
int get(int x){
	int ans =0;
	for(; x >= 1; x -= x&-x) ans += bit[x];
	return ans;
}
void solve(){
	for(int i = 1; i <= n; i++){
		kq += (i - 1) - get(a[i]);
		update(a[i], 1);
	}
	cout << kq << nn;
}
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	nhap();
	solve();
	return 0;
}
