#include <bits/stdc++.h>
using namespace std;
short int LG[5000][5000];
short int RG[5000][5000];
short int LS[5000][5000];
short int RS[5000][5000];
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) a[i] = v[i];
  int swaps = 0;
  for (int i = 1; i < n; i = i + 1) {
    int j = i;
    while (j > 0 && a[j] < a[j - 1]) {
      swaps++;
      swap(a[j], a[j - 1]);
      j = j - 1;
    }
  }
  for (int i = 0; i < n; i++) {
    int counter = 0;
    for (int j = i + 1; j < n; j++) {
      if (v[j] < v[i]) counter++;
      RS[i][j] = counter;
    }
  }
  for (int i = 0; i < n; i++) {
    int counter = 0;
    for (int j = i + 1; j < n; j++) {
      if (v[j] > v[i]) counter++;
      RG[i][j] = counter;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int counter = 0;
    for (int j = i - 1; j >= 0; j--) {
      if (v[j] > v[i]) counter++;
      LG[i][j] = counter;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int counter = 0;
    for (int j = i - 1; j >= 0; j--) {
      if (v[j] < v[i]) counter++;
      LS[i][j] = counter;
    }
  }
  int ans = swaps;
  int counter = 0, fans = ans;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      swaps = ans;
      if (v[i] < v[j]) {
        swaps++;
      } else {
        swaps--;
      }
      if (j - i - 1 > 0) {
        swaps += RG[i][j - 1];
        swaps -= RS[i][j - 1];
        swaps -= LG[j][i + 1];
        swaps += LS[j][i + 1];
      }
      if (swaps < fans) {
        fans = swaps;
        counter = 1;
      } else if (swaps == fans) {
        counter++;
      }
    }
  }
  cout << fans << " " << counter << "\n";
  return 0;
}
