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


int main(){

    long i, j;
    long c=0;
    long n;
    long *A;

    scanf( "%ld", &n);

    A = (long*)malloc(sizeof(long)*n);
    
    for( i=0; i<n; i++) scanf( "%ld", &A[i] );

    for( i=0; i<n; i++ ){
        for( j=i; j<n; j++){
            if( A[i] > A[j] ) c++;
        }
    }

    printf( "%ld\n", c);

    free(A);

    return 0;
}

