#include <stdio.h>
#define MAX 200000
#define INFTY 2000000000
#define N 1000000
int s[MAX],cnt=0,L[N],R[N];
void bubble(int,int,int);
void bubbleSort(int,int);

void bubble(int left,int mid,int right){
  int i,j=0,k;
  int x1=mid-left,x2=right-mid;

  for(i=0;i<x1;i++){
    L[i]=s[left+i];
  }

  for(i=0;i<x2;i++){
    R[i]=s[mid+i];
  }

  L[x1]=INFTY;
  R[x2]=INFTY;

  i=0;

  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      s[k]=L[i];
      i=i+1;
    }else{
      s[k]=R[j];
      j=j+1;
      cnt=cnt+(x1-i);
    }
  }
}

void bubbleSort(int left,int right){
  int middle;

  if(left+1<right){
    middle=(left+right+1)/2;
    bubbleSort(left,middle);
    bubbleSort(middle,right);
    bubble(left,middle,right);
  }
}

int main()
{
  int i,n;

  scanf("%d",&n);

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

  bubbleSort(0,n);

  printf("%d\n",cnt);

  return 0;
}