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 INF = (int)1e9;
const long long INFF = (long long)1e18;
const int MXN = (int)1e6 + 7;
const int mod = (int)1e9 + 7;
int a[MXN], b[MXN];
struct Seg {
  int ll[MXN << 2], rr[MXN << 2];
  pair<int, int> v[MXN << 2];
  void bd(int l, int r, int p) {
    ll[p] = l, rr[p] = r;
    if (l == r) {
      v[p] = {a[l], l};
      return;
    }
    int mid = (l + r) >> 1;
    bd(l, mid, p << 1);
    bd(mid + 1, r, p << 1 | 1);
    v[p] = min(v[p << 1], v[p << 1 | 1]);
  }
  pair<int, int> qy(int l, int r, int p) {
    if (l > rr[p] || ll[p] > r) return {INF, 0};
    if (l <= ll[p] && rr[p] <= r) return v[p];
    return min(qy(l, r, p << 1), qy(l, r, p << 1 | 1));
  }
} sg1;
struct Seg2 {
  int ll[MXN << 2], rr[MXN << 2], v[MXN << 2], d[MXN << 2];
  void bd(int l, int r, int p) {
    ll[p] = l, rr[p] = r;
    if (l == r) {
      v[p] = b[l];
      return;
    }
    int mid = (l + r) >> 1;
    bd(l, mid, p << 1);
    bd(mid + 1, r, p << 1 | 1);
    v[p] = max(v[p << 1], v[p << 1 | 1]);
  }
  inline void pushdown(int p) {
    d[p << 1] += d[p];
    d[p << 1 | 1] += d[p];
    v[p << 1] += d[p];
    v[p << 1 | 1] += d[p];
    d[p] = 0;
  }
  void md(int l, int r, int val, int p) {
    if (l > rr[p] || ll[p] > r) return;
    if (l <= ll[p] && rr[p] <= r) {
      d[p] += val;
      v[p] += val;
      return;
    }
    pushdown(p);
    md(l, r, val, p << 1);
    md(l, r, val, p << 1 | 1);
    v[p] = max(v[p << 1], v[p << 1 | 1]);
  }
  int qy(int l, int r, int p) {
    if (l > rr[p] || ll[p] > r) return 0;
    if (l <= ll[p] && rr[p] <= r) return v[p];
    pushdown(p);
    return max(qy(l, r, p << 1), qy(l, r, p << 1 | 1));
  }
} sg;
int ans;
void go(int l, int r, int dep) {
  if (l > r) return;
  pair<int, int> res = sg1.qy(l, r, 1);
  b[res.second] = dep;
  go(l, res.second - 1, dep + 1);
  go(res.second + 1, r, dep + 1);
  ans = max(ans, dep);
}
int ll[MXN], rr[MXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) a[n + i] = a[i];
  deque<pair<int, int> > stk;
  for (int i = 2 * n - 1; i > n; i--) {
    pair<int, int> val = {a[i], i};
    while (!stk.empty() && val < stk.back()) stk.pop_back();
    stk.push_back(val);
  }
  for (int i = n; i >= 1; i--) {
    int lb = 0, rb = ((int)(stk).size()) - 1, ok = -1;
    while (lb <= rb) {
      int mid = (lb + rb) >> 1;
      if (stk[mid].first < a[i]) {
        ok = mid;
        lb = mid + 1;
      } else {
        rb = mid - 1;
      }
    }
    if (ok == -1)
      ll[i] = i + n - 1;
    else
      ll[i] = stk[ok].second - 1;
    pair<int, int> val = {a[i], i};
    while (!stk.empty() && val < stk.back()) stk.pop_back();
    stk.push_back(val);
    if (!stk.empty() && stk.front().second == i + n - 1) stk.pop_front();
  }
  stk.clear();
  for (int i = 2; i <= n; i++) {
    pair<int, int> val = {a[i], i};
    while (!stk.empty() && val < stk.back()) stk.pop_back();
    stk.push_back(val);
  }
  for (int i = n + 1; i <= 2 * n; i++) {
    int lb = 0, rb = ((int)(stk).size()) - 1, ok = -1;
    while (lb <= rb) {
      int mid = (lb + rb) >> 1;
      if (stk[mid].first < a[i]) {
        ok = mid;
        lb = mid + 1;
      } else {
        rb = mid - 1;
      }
    }
    if (ok == -1)
      rr[i] = i - n + 1;
    else
      rr[i] = stk[ok].second + 1;
    pair<int, int> val = {a[i], i};
    while (!stk.empty() && val < stk.back()) stk.pop_back();
    stk.push_back(val);
    if (!stk.empty() && stk.front().second == i - n + 1) stk.pop_front();
  }
  sg1.bd(1, n, 1);
  go(1, n, 1);
  sg.bd(1, 2 * n, 1);
  int pos = 0;
  for (int i = 1; i < n; i++) {
    sg.md(i + 1, ll[i], -1, 1);
    int h = 0;
    if (rr[i + n] != i + 1) h = sg.qy(rr[i + n] - 1, rr[i + n] - 1, 1);
    sg.md(rr[i + n], i + n - 1, 1, 1);
    sg.md(i + n, i + n, h + 1, 1);
    int res = sg.qy(i + 1, i + n, 1);
    if (res < ans) {
      ans = res;
      pos = i;
    }
  }
  printf("%d %d\n", ans, pos);
  return 0;
}