#include<stdio.h>
 
#define MAX 200000
#define SENTINEL 1000000001
 
long long gA[MAX+1],gn,gcnt;
long long gL[ (MAX/2)+1 ],gR[ (MAX/2)+1 ];
  
void merge( long long left, long long mid, long long right )
{
    long long i,j,k;
    long long n1=mid-left;
    long long n2=right-mid;
  
    for( i=0; i<n1; i++ ) {
        gL[i]=gA[ left+i ];
    }
    for( i=0; i<n2; i++ ) {
        gR[i]=gA[ mid+i ];
    }
      
    gL[n1]=gR[n2]=SENTINEL;
    i=j=0;
    for( k=left; k<right; k++ ) {
        if( gL[i] <= gR[j] ) {
            gA[k]=gL[i++];
        } else {
            gcnt+=(n1-i);
            gA[k]=gR[j++];
        }
    }
    return;
}
  
void mergeSort( long long left, long long right )
{   
    long long mid;
    if( left+1 < right ) {
        mid=(left+right)/2;
        mergeSort( left, mid );
        mergeSort( mid, right );
        merge( left, mid, right );
    }
      
    return;
}
 
int main( void ) 
{   
    long long i;
     
    scanf( "%lld", &gn );
 
    for( i=0; i<gn; i++ ) {
        scanf( "%lld", &gA[i] );
    }
    gcnt=0;
    mergeSort( 0, gn );
    printf( "%lld\n",  gcnt );
 
    return 0;
}