//2020.1.16
//s1270188 xxxmk2
//alds1_05d

#include<stdio.h>
#include<limits.h>
#define N 200000

//prototype
long marge(int,int,int);
long m_sort(int,int);

//global
int data[N], num;

int main(){
  long i;

  //input
  scanf("%d",&num);
  for(i=0;i<num;i++) scanf("%d",&data[i]);

  //marge sort
  i=m_sort(0,num);

  //output
  printf("%ld\n",i);
  
  return 0;
}

long merge(int left,int mid,int right){
  int n1, n2, L[N/2+2], R[N/2+2];
  int i, j, k;
  long cnt=0;

  n1=mid-left;
  n2=right-mid;
  
  for(i=0;i<n1;i++) L[i]=data[left+i];
  for(i=0;i<n2;i++) R[i]=data[mid+i];

  L[n1]=R[n2]=INT_MAX;

  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<R[j]) data[k]=L[i++];
    else{
      data[k]=R[j++];
      cnt+=n1-i;
    }
  }
  return cnt;
}


long m_sort(int left,int right){
  int mid;
  long cnt=0;
  
  if(left+1<right){
    mid=(left+right)/2;
    cnt+=m_sort(left,mid);
    cnt+=m_sort(mid,right);
    cnt+=merge(left,mid,right);

    return cnt;
  }
  else return 0;
}

