Problem: Gardener Alex loves to grow trees. We remind that tree is a connected acyclic graph on n vertices. 

Today he decided to grow a rooted binary tree. A binary tree is a tree where any vertex has no more than two sons. Luckily, Alex has a permutation of numbers from 1 to n which he was presented at his last birthday, so he decided to grow a tree according to this permutation. To do so he does the following process: he finds a minimum element and makes it a root of the tree. After that permutation is divided into two parts: everything that is to the left of the minimum element, and everything that is to the right. The minimum element on the left part becomes the left son of the root, and the minimum element on the right part becomes the right son of the root. After that, this process is repeated recursively on both parts.

Now Alex wants to grow a forest of trees: one tree for each cyclic shift of the permutation. He is interested in what cyclic shift gives the tree of minimum depth. Unfortunately, growing a forest is a hard and long process, but Alex wants the answer right now. Will you help him?

We remind that cyclic shift of permutation a_1, a_2, …, a_k, …, a_n for k elements to the left is the permutation a_{k + 1}, a_{k + 2}, …, a_n, a_1, a_2, …, a_k.

Input

First line contains an integer number n ~ (1 ⩽ n ⩽ 200 000) — length of the permutation.

Second line contains n integer numbers a_1, a_2, …, a_n ~ (1 ⩽ a_i ⩽ n), and it is guaranteed that all numbers occur exactly one time.

Output

Print two numbers separated with space: minimum possible depth of a tree and how many elements we need to shift left to achieve this depth. The number of elements should be a number from 0 to n - 1. If there are several possible answers, print any of them.

Example

Input


4
1 2 3 4


Output


3 2

Note

The following picture depicts all possible trees for sample test and cyclic shifts on which they are achieved. 

<image>

Solution (in CPP):

Solution:
#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;
}