#include <bits/stdc++.h>
#pragma comment(linker, "/stack:30000000")
using namespace std;
const int mx[4] = {1, -1, 0, 0};
const int my[4] = {0, 0, 1, -1};
const int Direct[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
const int Nmax = 6000;
class Fenwick_tree {
 private:
  std::vector<long long> t;
  int size;
  long long get0(int l) {
    long long res = 0;
    for (; l > 0; l = (l & (l + 1)) - 1) res += t[l];
    return res;
  }

 public:
  void Assign(int n) {
    size = n;
    t.assign(size + 1, 0);
  }
  void Clear() {
    for (int i = 1; i <= size; i++) t[i] = 0;
  }
  void Erase() {
    int size = 0;
    t.clear();
    t.resize(0);
  }
  void Build(std::vector<long long> &a) {
    for (int i = 1; i <= size; i++) update(i, a[i]);
  }
  long long get(int l, int r) { return get0(r) - get0(l - 1); }
  void update(int r, long long x) {
    for (; r <= size; r |= (r + 1)) t[r] += x;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i <= n - 1; i++) cin >> a[i];
  Fenwick_tree c;
  c.Assign(n);
  int Count = 0;
  int answer = 0;
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++)
      if (a[j] > a[i]) answer++;
  int Start = answer;
  answer = 0;
  for (int i = 0; i < n; i++) {
    c.Clear();
    for (int j = i + 1; j < n; j++) {
      int x = a[i], y = a[j];
      int Current = 0;
      Current = 1 + c.get(min(x, y) + 2, max(x, y)) * 2;
      if (x > y) Current *= -1;
      if (Current < answer)
        answer = Current, Count = 1;
      else if (Current == answer)
        Count++;
      c.update(a[j] + 1, +1);
    }
  }
  cout << Start + answer << " " << Count << endl;
  return 0;
}
