
#include<stdio.h>

#define MAX 200000
#define SENTINEL 1000000001

int gA[MAX+1],gn,gcnt;
int gL[ (MAX/2)+1 ],gR[ (MAX/2)+1 ];
 
void merge( int left, int mid, int right )
{
    int i,j,k;
    int n1=mid-left;
    int 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( int left, int right )
{   
    int mid;
    if( left+1 < right ) {
        mid=(left+right)/2;
        mergeSort( left, mid );
        mergeSort( mid, right );
        merge( left, mid, right );
    }
     
    return;
}


int main( void ) 
{	
	int i;
	
    scanf( "%d", &gn );

	for( i=0; i<gn; i++ ) {
		scanf( "%d", &gA[i] );
	}
	gcnt=0;
	mergeSort( 0, gn );
	printf( "%d\n",  gcnt );

    return 0;
}