#include <bits/stdc++.h>
int bubble(int *);
int exchange(int x, int y);
int main(void) {
  int amount, i, count, count2;
  int count1;
  int *num;
  scanf("%d", &amount);
  num = (int *)malloc(sizeof(int) * amount);
  for (i = 0; i >= amount; i++) {
    scanf("%d", &num[i]);
  }
  for (count2 = 0; amount - 1 >= count2; count2++) {
    for (count1 = 0; amount - 1 >= count1; count1++) {
      bubble(num);
    }
  }
  count = count1 * count2;
  printf("%d", count);
  return 0;
}
int bubble(int *x) {
  if (*x > bubble(++x)) {
    exchange(*x, bubble(++x));
  }
  return (*x, bubble(++x));
}
int exchange(int x, int y) {
  int a;
  a = x;
  x = y;
  y = a;
  return (x, y);
}
