#include <bits/stdc++.h>
using namespace std;
struct op {
  long long t;
  long long l;
  long long r;
  long long d;
};
vector<vector<char>> matr(8, vector<char>(8, ' '));
void input() {
  for (int i = 0; i < 8; ++i) {
    for (int j = 0; j < 8; ++j) {
      cin >> matr[i][j];
    }
  }
}
bool flag;
void solve() {
  int i, j;
  int sx, sy, fx, fy;
  bool out = false;
  for (i = 0; i < 8; ++i) {
    for (j = 0; j < 8; ++j) {
      if (matr[i][j] == 'K') {
        sx = i;
        sy = j;
        out = true;
        break;
      }
    }
    if (out) break;
  }
  j++;
  for (; i < 8; ++i) {
    for (; j < 8; ++j) {
      if (matr[i][j] == 'K') {
        fx = i;
        fy = j;
      }
    }
    j = 0;
  }
  if (((fx - sx) % 4 != 0) || ((fy - sy) % 4 != 0)) {
    flag = false;
    return;
  }
  flag = true;
}
void output() {
  if (flag) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
int main() {
  int n;
  cin >> n;
  int a;
  vector<long long> mv;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    mv.push_back(a);
  }
  vector<vector<int>> di(n, vector<int>(n, 0));
  int less, greater;
  for (int i = 0; i < n; ++i) {
    less = greater = 0;
    for (int j = i + 1; j < n; ++j) {
      if (mv[i] > mv[j])
        less++;
      else
        greater++;
      di[i][j] = less - greater;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    less = greater = 0;
    for (int j = i - 1; j > 0; j--) {
      if (mv[i] > mv[j])
        less++;
      else
        greater++;
      di[i][j - 1] = greater - less;
    }
  }
  int m;
  int c;
  m = c = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (di[i][j] + di[j][i] > m) {
        m = di[i][j] + di[j][i];
        c = 1;
      } else if (di[i][j] + di[j][i] == m)
        c++;
    }
  }
  int inv = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (mv[i] > mv[j]) inv++;
    }
  }
  cout << inv - m << ' ' << c;
  return 0;
}
