#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return b / gcd(a, b) * a; }
int n, g[5001];
int s;
int l[5000][5001];
int best = 1 << 30, freq;
int SWAP(int a, int b) {
  int B = g[b];
  int A = g[a];
  int res = s;
  res -= (b - a - 2) - (l[B][b] - l[B][a]);
  res += (l[B][b] - l[B][a]);
  res -= (l[A][b] - l[A][a]);
  res += (b - a - 2) - (l[A][b] - l[A][a]);
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", g + i);
    for (int j = i - 1; j; --j) s += g[i] < g[j];
  }
  for (int(i) = 0; i < int(n); ++i) {
    l[i][1] = 0;
    for (int j = 2; j <= n; ++j) l[i][j] = l[i][j - 1] + (i > g[j - 1]);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      int cost = SWAP(i, j);
      if (g[i] < g[j])
        ++cost;
      else
        --cost;
      if (cost == best)
        ++freq;
      else if (cost < best) {
        best = cost;
        freq = 1;
      }
    }
  }
  cout << best << " " << freq << endl;
}
