#include<stdio.h> 
#define INFTY 2000000000
#define MAX 200000


long long merge(int S[], int left, int mid, int right){

	int n1 , n2;
	int i , j , k;
	long long c = 0;
	
	n1 = mid - left;
	n2 = right - mid;
	
	int L[MAX/2+2] , R[MAX/2+2];
	
	for( i = 0; i < n1; i++ ){
		L[i] = S[left + i];
	}
	for( i = 0; i < n2; i++ ){
		R[i] = S[mid + i];
	}
	
	L[n1] = R[n2] = INFTY;
	
	i = 0;
	j = 0;
	
	for ( k = left; k < right; k++ ){
		
		if( L[i] <= R[j] ){
			S[k] = L[i];
			i++;
		}else{
			S[k] = R[j];
			j++;
			c += n1 - i;
		}
	}
	
	return c;
}

long long mergeSort(int S[], int left, int right){
	
	int mid;
	long long v1 , v2 , v3;
	
	if ( left+1 < right ){
		
		mid = (left + right)/2;
		v1 = mergeSort(S, left, mid);
		v2 = mergeSort(S, mid, right);
		v3 = merge(S, left, mid, right);
		return v1 + v2 + v3;
		
	}else{ return 0; }
	
}

int main( void ){
	
	int n;
	int S[MAX];
	int i;
	
	long long ans;
	
	scanf( "%d" , &n );
	
	for( i = 0; i < n; i++ ){
		scanf( "%d" , &S[i] );
	}
	
	ans = mergeSort(S, 0, n);
	printf( "%lld\n" , ans );
	
	return 0;
	
}
