#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000 + 50;
const int maxm = 1300000 + 100;
const int maxt = 3000000 + 100;
const int maxk = 10 + 3;
const int M = 2010;
const long long unit = 1LL;
const int INF = 0x3f3f3f3f;
const long long Inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
const double inf = 1e15;
const double pi = acos(-1.0);
const long long mod = 998244353LL, gg = 3LL, inv2 = 499122177LL;
inline long long read() {
  long long x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
int n;
int a[maxn], b[maxn];
struct Node {
  int lch, rch, fa;
} node[maxn];
struct ST {
  int Min[maxn][20], lg2[maxn];
  void init(int n) {
    lg2[1] = 0;
    for (int i = 2; i <= n; ++i) lg2[i] = lg2[i >> 1] + 1;
    for (int l = 1; l < 20; ++l)
      for (int i = 1; i + (1 << l) - 1 <= n; ++i)
        Min[i][l] = min(Min[i][l - 1], Min[i + (1 << (l - 1))][l - 1]);
  }
  int QMin(int l, int r) {
    int k = lg2[r - l + 1];
    return min(Min[l][k], Min[r - (1 << k) + 1][k]);
  }
} st;
int w[maxn], dep[maxn], pos[maxn];
struct SegTree {
  int Max[maxn << 2], lazy[maxn << 2];
  void PushUp(int rt) { Max[rt] = max(Max[rt << 1], Max[rt << 1 | 1]); }
  void PushDown(int rt) {
    if (lazy[rt]) {
      Max[rt << 1] += lazy[rt], Max[rt << 1 | 1] += lazy[rt];
      lazy[rt << 1] += lazy[rt], lazy[rt << 1 | 1] += lazy[rt];
      lazy[rt] = 0;
    }
  }
  void Build(int l, int r, int rt) {
    if (l == r) {
      Max[rt] = w[l];
      return;
    }
    int m = (l + r) >> 1;
    Build(l, m, rt << 1), Build(m + 1, r, rt << 1 | 1);
    PushUp(rt);
  }
  int AskMax(int L, int R, int l, int r, int rt) {
    if (L <= l && r <= R) return Max[rt];
    PushDown(rt);
    int m = (l + r) >> 1, ans = 0;
    if (L <= m) ans = max(ans, AskMax(L, R, l, m, rt << 1));
    if (R > m) ans = max(ans, AskMax(L, R, m + 1, r, rt << 1 | 1));
    PushUp(rt);
    return ans;
  }
  void Add(int L, int R, int x, int l, int r, int rt) {
    if (L <= l && r <= R) {
      Max[rt] += x;
      lazy[rt] += x;
      return;
    }
    PushDown(rt);
    int m = (l + r) >> 1;
    if (L <= m) Add(L, R, x, l, m, rt << 1);
    if (R > m) Add(L, R, x, m + 1, r, rt << 1 | 1);
    PushUp(rt);
  }
} seg;
int dfs(int le, int ri) {
  if (le > ri) return 0;
  int u = st.QMin(le, ri);
  int p = pos[u];
  node[u].lch = dfs(le, p - 1);
  node[u].rch = dfs(p + 1, ri);
  return u;
}
void dfs2(int u) {
  if (node[u].lch) {
    dep[node[u].lch] = dep[u] + 1;
    node[node[u].lch].fa = u;
    dfs2(node[u].lch);
  }
  if (node[u].rch) {
    dep[node[u].rch] = dep[u] + 1;
    node[node[u].rch].fa = u;
    dfs2(node[u].rch);
  }
}
deque<int> que;
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  int turn = 0;
  if (a[n] != 1) {
    int j = n;
    while (a[j] != 1) --j;
    turn = j;
    ++j;
    copy(a + j, a + n + 1, b + 1);
    copy(a + 1, a + j, b + n - j + 2);
    copy(b + 1, b + n + 1, a + 1);
  }
  for (int i = 1; i <= n; ++i) pos[a[i]] = i, st.Min[i][0] = a[i];
  st.init(n);
  node[1].lch = dfs(1, n - 1);
  node[1].rch = node[1].fa = 0;
  dep[1] = 1;
  dfs2(1);
  for (int i = 1; i <= n; ++i) w[i] = dep[a[i]];
  int le = 1, ri = n;
  seg.Build(1, 2 * n, 1);
  int ans = seg.AskMax(1, n, 1, 2 * n, 1), anst = turn;
  int m = n - 1;
  que.push_back(1);
  while (m--) {
    int x = a[le];
    int fx = node[x].fa;
    int pfx = pos[fx];
    if (le + 1 <= pfx - 1) seg.Add(le + 1, pfx - 1, -1, 1, 2 * n, 1);
    node[fx].lch = node[x].rch;
    if (node[x].rch) node[node[x].rch].fa = fx;
    while (!que.empty() && que.back() > x) que.pop_back();
    int y = que.back();
    que.push_back(x);
    node[x].fa = y;
    node[x].lch = node[y].rch;
    node[y].rch = x;
    node[x].rch = 0;
    int py = pos[y];
    if (py + 1 <= ri) seg.Add(py + 1, ri, 1, 1, 2 * n, 1);
    int d = seg.AskMax(py, py, 1, 2 * n, 1);
    seg.Add(ri + 1, ri + 1, d + 1, 1, 2 * n, 1);
    ++le, ++ri, ++turn, pos[x] = ri, a[ri] = x;
    int tmp = seg.AskMax(le, ri, 1, 2 * n, 1);
    if (tmp < ans) {
      ans = tmp;
      anst = turn;
    }
  }
  while (anst >= n) anst -= n;
  printf("%d %d\n", ans, anst);
  return 0;
}
