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;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
  return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
  o << "{";
  for (const T& v : vc) o << v << ",";
  o << "}";
  return o;
}
using ll = long long;
template <class T>
using V = vector<T>;
template <class T>
using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
struct segtree {
  using D = int;
  D inf = 1e9;
  using P = pair<D, int>;
  int N;
  vector<P> val;
  segtree() {}
  segtree(int n) {
    N = 1;
    while (N < n) N *= 2;
    val.assign(N * 2, P(inf, -1));
    for (int i = 0; i < (int)(n); i++) val[i + N].second = i;
    for (int i = N - 1; i > 0; i--) val[i] = min(val[i * 2], val[i * 2 + 1]);
  }
  segtree(const vector<D>& ds) {
    int n = ds.size();
    N = 1;
    while (N < n) N *= 2;
    val.assign(N * 2, P(inf, -1));
    for (int i = 0; i < (int)(n); i++) val[i + N] = P(ds[i], i);
    for (int i = N - 1; i > 0; i--) val[i] = min(val[i * 2], val[i * 2 + 1]);
  }
  void assign(int k, D d) {
    k += N;
    val[k] = P(d, k - N);
    k /= 2;
    while (k) {
      val[k] = min(val[k * 2], val[k * 2 + 1]);
      k /= 2;
    }
  }
  P getmina(int a, int b) {
    P res = P(inf, -1);
    a += N, b += N;
    while (a < b) {
      if (a & 1) res = min(res, val[a++]);
      if (b & 1) res = min(res, val[--b]);
      a /= 2, b /= 2;
    }
    return res;
  }
};
V<int> solve(V<int> p) {
  int N = p.size();
  int rot = 0;
  {
    for (int i = 0; i < (int)(N); i++)
      if (p[i] == 0) {
        rot = i + 1;
        break;
      }
    rotate(p.begin(), p.begin() + rot, p.end());
  }
  true;
  segtree seg(p);
  V<int> depth(N, -1);
  V<int> lch(N, -1), rch(N, -1);
  function<int(int, int, int)> dfs = [&](int l, int r, int p) {
    if (l >= r) return -1;
    int m = seg.getmina(l, r).second;
    if (p != -1 && p > m) lch[p] = m;
    if (p != -1 && p < m) rch[p] = m;
    depth[m] = max(depth[m], dfs(l, m, m) + 1);
    depth[m] = max(depth[m], dfs(m + 1, r, m) + 1);
    return depth[m];
  };
  dfs(0, N, -1);
  V<int> A(N);
  for (int i = 0; i < (int)(N); i++)
    if (rch[i] != -1) A[i] = 1 + depth[rch[i]];
  V<int> chain;
  multiset<int> st;
  for (int v = 0; v < (int)(N); v++) {
    true;
    true;
  }
  {
    for (int x = N - 1, d = 0; x != -1; x = lch[x], d++) {
      chain.push_back(x);
      st.insert(A[x] + d);
    }
  }
  V<int> res(N);
  for (int i = 0; i < (int)(N); i++) {
    res[i] = *st.rbegin();
    if (i != N - 1) {
      assert(chain.back() == i);
      {
        int er = A[i] + (int)chain.size() - 1;
        auto it = st.find(er);
        assert(it != st.end());
        st.erase(it);
        chain.pop_back();
      }
      for (int x = rch[i]; x != -1; x = lch[x]) {
        int ad = A[x] + (int)chain.size();
        st.insert(ad);
        chain.push_back(x);
      }
    }
  }
  rotate(res.begin(), res.begin() + N - rot, res.end());
  true;
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  V<int> p(N);
  for (int i = 0; i < (int)(N); i++) cin >> p[i], p[i]--;
  V<int> a = solve(p);
  reverse(p.begin(), p.end());
  V<int> b = solve(p);
  int ag = 0;
  for (int i = 0; i < (int)(N); i++) {
    if (max(a[i], b[(N - i) % N]) < max(a[ag], b[(N - ag) % N])) ag = i;
  }
  cout << max(a[ag], b[(N - ag) % N]) + 1 << " " << ag << endl;
}