import java.util.*; class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m[] = new int[n+1]; int answer = 0; for(int i = 1; i <= n; i++){ m[i] = sc.nextInt(); } for(int i = 1; i < n; i++){ for(int j = i+1; j <= n; j++){ if(m[i] > m[j]){ answer++; } } } System.out.println(answer); } }