#include<stdio.h>

#define M 200000
#define MH 100000 
#define S 2000000000

int L[MH],R[MH];
long b1,b2,b3;

long mer(int *a,int n,int left,int right,int man){

  int i,j=0,k=0;
  long cou=0;

  int na=man-left;
  int nb=right-man;

  for(i=0;i<na;i++) L[i]=a[left+i];
  for(i=0;i<nb;i++) R[i]=a[man+i];

  L[na]=R[nb]=S;

  i=0;

  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      a[k]=L[i];
      i++;
    }else{
      
      a[k]=R[j];
      j++;
      cou+=na-i;
    }
  }
  return cou;
}

long sort(int *a,int n,int right,int left){
  int man;
  

  if(left+1<right){
    man=(left+right)/2;
    b1=sort(a,n,man,left);
    b2=sort(a,n,right,man);
    b3=mer(a,n,left,right,man);
    return b1+b2+b3;
  }else return 0;
}

int main(){
  int a[M],n,i;
  long ans;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  /*printf("%ld\n",b1);
 printf("%ld\n",b2);
 printf("%ld\n",b3);*/

  ans=sort(a,n,n,0);
  printf("%ld\n",ans);

  return 0;
}