import java.io.*;
import java.util.Arrays;
class Main{
static BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
static int[] a, tr;
static long[] greater, small;
static int n;
public static void main(String[] args) throws Exception{
n = Integer.valueOf(read.readLine());
a = new int[n + 1]; tr = new int[n + 2];
greater = new long[n + 1]; small = new long[n + 1];
String[] ss = read.readLine().split(" ");
for(int i = 0; i < n; i++) a[i] = Integer.valueOf(ss[i]);
for(int i = 0; i < n; i++){
int x = a[i];
greater[i] = sum(n) - sum(x);
small[i] = sum(x - 1);
add(x, 1);
}
Arrays.fill(tr, 0);
long first = 0, second = 0;
for(int i = n - 1; i >= 0; i--){
int x = a[i];
first += greater[i] * (sum(n) - sum(x));
second += small[i] * (sum(x - 1));
add(x, 1);
}
System.out.println(first + " " + second);
}
//在下标x的位置 增加c
public static void add(int x, int c){
for(int i = x; i <= n; i += lowBit(i)){
tr[i] += c;
}
}
public static long sum(int r){
int res = 0;
for(int i = r; i > 0; i -= lowBit(i)){
res += tr[i];
}
return res;
}
public static int lowBit(int x){
return x & -x;
}
}