#include <bits/stdc++.h>
using namespace std;
int dx4[] = {-1, 0, 1, 0};
int dy4[] = {0, 1, 0, -1};
int dx6[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dy6[] = {0, 1, 1, 1, 0, -1, -1, -1};
void Duxar(int _this_line) {}
template <class T>
void ReadNo(T &_value) {
  T _sign = 1;
  char ch;
  _value = 0;
  while (!isdigit(ch = getchar())) {
    (ch == '-') && (_sign = -1);
  }
  do {
    _value = _value * 10 + (ch - '0');
  } while (isdigit(ch = getchar()));
  _value *= _sign;
}
template <class T>
void AddNr(T &a, T b) {
  a = a + b;
  while (a >= 1000000007) {
    a -= 1000000007;
  }
  while (a < 0) {
    a += 1000000007;
  }
}
int N, best, cnt, ans;
vector<int> aib, values;
void Insert(int pos) {
  while (pos <= N) {
    ++aib[pos];
    pos += pos & ((pos - 1) ^ pos);
  }
}
int Query(int pos) {
  int ans = 0;
  while (pos > 0) {
    ans += aib[pos];
    pos -= pos & ((pos - 1) ^ pos);
  }
  return ans;
}
int main() {
  int i, j, sumi, sumj;
  pair<int, int> pr;
  ReadNo(N);
  values.resize(N + 1);
  aib.resize(N + 1);
  for (i = 1; i <= N; ++i) {
    ReadNo(values[i]);
    ++values[i];
  }
  for (i = 1; i < N; ++i) {
    fill((aib).begin(), (aib).end(), 0);
    for (j = i; j <= N; ++j) {
      Insert(values[j]);
      sumi = Query(values[i] - 1);
      sumj = Query(values[j] - 1);
      if (sumi - sumj > best) {
        best = sumi - sumj;
        pr = {i, j};
        cnt = 1;
      } else if (sumi - sumj == best) {
        ++cnt;
      }
    }
  }
  swap(values[pr.first], values[pr.second]);
  fill((aib).begin(), (aib).end(), 0);
  for (i = N; i > 0; --i) {
    ans += Query(values[i] - 1);
    Insert(values[i]);
  }
  printf("%d %d\n", ans, cnt);
  return 0;
}
