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

unsigned int a[N];
int cnt = 0;
void inversion(int* a, int l, int r){
int m = (r+l)/2;
int i = 0, j = 0; 
 if(l == r)
  return;

   inversion(a, l, m);  
   inversion(a, m + 1, r);

    for(i = l; i <= m; i++){
     for(j = m+1; j <= r; j++){
      if(a[i] > a[j]){
        cnt++;
      }   
    }
   }

}



int main(int argc, char** argv){
int n, i = 0;
   scanf("%d", &n);

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


   inversion(a, 0, n-1);

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

  return 0;
}