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 N = 2e5 + 5;
int perm[N], cperm[2 * N], lsmaller[2 * N], rsmaller[2 * N], tree[4 * N],
    lazy[4 * N], tree2[4 * N], n;
void propagate(int node, int l, int r) {
  if (lazy[node] == 0) return;
  tree[node] += lazy[node];
  if (l != r) lazy[node * 2] += lazy[node], lazy[node * 2 + 1] += lazy[node];
  lazy[node] = 0;
}
void update(int node, int l, int r, int st, int en, int val) {
  propagate(node, l, r);
  if (st > r || en < l || st > en) return;
  if (st <= l && r <= en) {
    lazy[node] += val;
    propagate(node, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  update(node * 2, l, mid, st, en, val);
  update(node * 2 + 1, mid + 1, r, st, en, val);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}
int query(int node, int l, int r, int st, int en) {
  propagate(node, l, r);
  if (st > r || en < l || st > en) return 0;
  if (st <= l && r <= en) return tree[node];
  int mid = (l + r) >> 1;
  return max(query(node * 2, l, mid, st, en),
             query(node * 2 + 1, mid + 1, r, st, en));
}
void build(int node, int l, int r) {
  if (l == r) {
    tree2[node] = l;
    return;
  }
  int mid = (l + r) >> 1;
  build(node * 2, l, mid);
  build(node * 2 + 1, mid + 1, r);
  if (perm[tree2[node * 2]] < perm[tree2[node * 2 + 1]])
    tree2[node] = tree2[node * 2];
  else
    tree2[node] = tree2[node * 2 + 1];
}
int query2(int node, int l, int r, int st, int en) {
  if (st > r || en < l || st > en) return -1;
  if (st <= l && r <= en) return tree2[node];
  int mid = (l + r) >> 1;
  int v1 = query2(node * 2, l, mid, st, en);
  int v2 = query2(node * 2 + 1, mid + 1, r, st, en);
  if (v1 == -1)
    return v2;
  else if (v2 == -1)
    return v1;
  else if (perm[v1] < perm[v2])
    return v1;
  else
    return v2;
}
void dfs(int l, int r, int depth) {
  if (l > r) return;
  int idx = query2(1, 0, n - 1, l, r);
  update(1, 0, n - 1, idx, idx, depth);
  dfs(l, idx - 1, depth + 1);
  dfs(idx + 1, r, depth + 1);
}
void update_range(int l, int r, int val) {
  l %= n, r %= n;
  if (l > r)
    update(1, 0, n - 1, l, n - 1, val), update(1, 0, n - 1, 0, r, val);
  else
    update(1, 0, n - 1, l, r, val);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> perm[i];
  for (int i = 0; i < 2 * n; i++) cperm[i] = perm[i % n];
  build(1, 0, n - 1);
  dfs(0, n - 1, 1);
  stack<int> st;
  memset(lsmaller, -1, sizeof lsmaller);
  memset(rsmaller, -1, sizeof rsmaller);
  for (int i = 0; i < 2 * n; i++) {
    while (st.size() && cperm[st.top()] > cperm[i]) st.pop();
    if (st.size()) lsmaller[i] = st.top();
    st.push(i);
  }
  while (st.size()) st.pop();
  for (int i = 2 * n - 1; i >= 0; i--) {
    while (st.size() && cperm[st.top()] > cperm[i]) st.pop();
    if (st.size()) rsmaller[i] = st.top();
    st.push(i);
  }
  int mn = query(1, 0, n - 1, 0, n - 1), shift = 0;
  for (int i = 0; i < n - 1; i++) {
    int right = rsmaller[i];
    right = min(right, i + n);
    if (right != i + 1) update_range(i + 1, right - 1, -1);
    int left = lsmaller[i + n];
    if (left + 1 != i + n) update_range(left + 1, i + n - 1, 1);
    int val = query(1, 0, n - 1, i, i);
    update(1, 0, n - 1, i, i, -val);
    if (lsmaller[i + n] == i)
      val = 1;
    else
      val = query(1, 0, n - 1, lsmaller[i + n] % n, lsmaller[i + n] % n) + 1;
    update(1, 0, n - 1, i, i, val);
    val = query(1, 0, n - 1, 0, n - 1);
    if (val < mn) {
      mn = val;
      shift = i + 1;
    }
  }
  cout << mn << ' ' << shift;
  return 0;
}