#include <bits/stdc++.h>
int map[5002][5002];
int A[5002];
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0, sum = 0, cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
    A[i]++;
    sum += map[i - 1][A[i]];
    for (int j = n; j >= A[i]; j--) map[i][j] = map[i - 1][j];
    for (int j = A[i] - 1; j >= 0; j--) map[i][j] = map[i - 1][j] + 1;
  }
  ans = sum;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      int tmp = sum - 2 * (map[i - 1][A[i]] + map[j - 1][A[j]] -
                           map[i - 1][A[j]] - map[j - 1][A[i]]);
      if (A[i] > A[j]) tmp++;
      if (tmp < ans) {
        ans = tmp, cnt = 1;
      } else if (tmp == ans) {
        cnt++;
      }
    }
  printf("%d %d", ans, cnt);
  return 0;
}
