#include <bits/stdc++.h>
using namespace std;
int n, V[5001], A[5001], x;
short int MI[5001][5001], MD[5001][5001], MYI[5001][5001], MYD[5001][5001];
bool X[5001], Y[5001];
int main() {
  scanf("%d", &(n));
  for (int(i) = (0); (i) < (n); (i)++) {
    scanf("%d", &(A[i]));
    V[A[i]] = i;
  }
  for (int(i) = (0); (i) < (n); (i)++) {
    x = V[i];
    MI[x][0] = 0;
    for (int i = x - 1; i >= 0; i--)
      if (X[i])
        MI[x][x - i] = MI[x][x - i - 1] + 1;
      else
        MI[x][x - i] = MI[x][x - i - 1];
    MD[x][0] = 0;
    for (int i = x + 1; i < n; i++)
      if (X[i])
        MD[x][i - x] = MD[x][i - x - 1] + 1;
      else
        MD[x][i - x] = MD[x][i - x - 1];
    X[x] = 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    x = V[i];
    MYI[x][0] = 0;
    for (int i = x - 1; i >= 0; i--)
      if (Y[i])
        MYI[x][x - i] = MYI[x][x - i - 1] + 1;
      else
        MYI[x][x - i] = MYI[x][x - i - 1];
    MYD[x][0] = 0;
    for (int i = x + 1; i < n; i++)
      if (Y[i])
        MYD[x][i - x] = MYD[x][i - x - 1] + 1;
      else
        MYD[x][i - x] = MYD[x][i - x - 1];
    Y[x] = 1;
  }
  int mn = (1 << 30), cnt = 1, aux, tot = 0;
  for (int(i) = (0); (i) < (n); (i)++) tot += MYI[i][i];
  for (int(i) = (0); (i) < (n); (i)++)
    for (int(j) = (i + 1); (j) < (n); (j)++) {
      aux = tot + MI[j][j - i - 1] - MD[i][j - i - 1] - MYI[j][j - i - 1] +
            MYD[i][j - i - 1];
      if (A[i] > A[j])
        aux--;
      else
        aux++;
      if (aux < mn) {
        mn = aux;
        cnt = 1;
      } else if (aux == mn)
        cnt++;
    }
  printf("%d %d\n", mn, cnt);
}
