#include<stdio.h>
#define N 200000
doubele count=0;
void margesort(int,int);
void marge(int,int,int);
 
int S[N],Left[N/2+1],Right[N/2+1];

int main(){
  int n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) 
    scanf("%d",&S[i]);
  
  margesort(0,n);
  printf("%0.f\n",count); 
  
  return 0;
}

void margesort(int left,int right){
  int mid;
  if(left+1 < right){ 
    mid = (left + right)/2;
    margesort(left,mid);
    margesort(mid,right);
    marge(left,mid,right);
  }
}

void marge(int left,int mid,int right){
  int n1,n2,i,j=0,k;
  
  n1 = mid - left;
  n2 = right - mid;
  
  for(i=0;i<n1;i++) Left[i] = S[left+i];
  Left[n1]=-1;
  for(i=0;i<n2;i++) Right[i] = S[mid+i];
  Right[n2]=-1;
  
  i=0;
  for(k=left;k<right;k++){
    if(Left[i] > Right[j]){  
      S[k] = Left[i];
      i++;
    count += n2 - j;
    }
    else{
      S[k] = Right[j];
      j++;
    }
  }
}