#include <bits/stdc++.h>
using namespace std;
int dd[5002][5002], n, num[5002], sum;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &num[i]);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dd[i][j] = 0;
  sum = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (num[i] < num[j]) sum++;
    }
  }
  for (int i = 0; i < n; i++) {
    int tmp = num[i];
    for (int j = 0; j < tmp; j++) dd[i + 1][j] = dd[i][j] + 1;
    for (int j = tmp; j < n; j++) dd[i + 1][j] = dd[i][j];
  }
  int mi = 1000000000;
  int out = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (i == j) continue;
      if (num[i] > num[j]) continue;
      int a = num[j], b = num[i];
      int tmp = (dd[i][b] - dd[j][b]) - (dd[i][a] - dd[j][a]);
      tmp = sum - 2 * tmp + 1;
      if (tmp > mi)
        continue;
      else if (tmp == mi)
        out++;
      else if (tmp < mi) {
        mi = tmp;
        out = 1;
      }
    }
  }
  printf("%d %d\n", mi, out);
  return 0;
}
