#include <stdio.h>
#include <stdlib.h>

#define MaxNum 200000


int main( void )
{
    unsigned long int num=0;
    unsigned long int i,j=0;
    unsigned long int cnt = 0;    // 反転数
    unsigned long int tmp = 0;

    unsigned char   B[MaxNum] = {};
    
    scanf("%lu",&num);
    if(num == 0)
    {
        printf("0\n");
        return 0;
    }
    
    for(i=0; i<num; i++)
    {
        scanf("%lu", &tmp);
        B[tmp]=1;
        
        for(j=tmp+1;j<MaxNum;j++)
        {
            cnt=cnt+B[j];
        }
    }
    
    printf("%lu\n", cnt);
    
    return 0;
}


