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;
using ll = long long;
mt19937 mt(736);
int up(int n) {
  int r = 1;
  while (r < n) r <<= 1;
  return r;
}
class segtreepii {
  vector<pair<int, int>> arr;
  [[nodiscard]] pair<int, int> segmin(int l, int r, int cl, int cr,
                                      int v) const {
    if (r <= cl || cr <= l) return {numeric_limits<int>::max(), -1};
    if (l <= cl && cr <= r) return arr[v];
    int ct = (cl + cr) / 2;
    return min(segmin(l, r, cl, ct, 2 * v), segmin(l, r, ct, cr, 2 * v + 1));
  }

 public:
  segtreepii(const vector<pair<int, int>> &val)
      : arr(2 * up(val.size()), {numeric_limits<int>::max(), -1}) {
    copy(val.begin(), val.end(), arr.begin() + arr.size() / 2);
    for (int i = (int)arr.size() / 2 - 1; i > 0; i--)
      arr[i] = min(arr[2 * i], arr[2 * i + 1]);
  }
  [[nodiscard]] pair<int, int> segmin(int l, int r) const {
    return segmin(l, r, 0, arr.size() / 2, 1);
  }
  [[nodiscard]] pair<int, int> segmin() const {
    return segmin(0, arr.size() / 2, 0, arr.size() / 2, 1);
  }
  void set(int wh, const pair<int, int> &x) {
    wh += arr.size() / 2;
    arr[wh] = x;
    while ((wh >>= 1) > 0) arr[wh] = min(arr[2 * wh], arr[2 * wh + 1]);
  }
};
class segtreei {
  vector<int> arr, laz;
  [[nodiscard]] int segmax(int l, int r, int cl, int cr, int v) {
    if (r <= cl || cr <= l) return 0;
    push(v);
    if (l <= cl && cr <= r) return arr[v];
    int ct = (cl + cr) / 2;
    auto ret =
        max(segmax(l, r, cl, ct, 2 * v), segmax(l, r, ct, cr, 2 * v + 1));
    upd(v);
    return ret;
  }
  void push(int v) {
    arr[v] += laz[v];
    if (v < arr.size() / 2) {
      laz[2 * v] += laz[v];
      laz[2 * v + 1] += laz[v];
    }
    laz[v] = 0;
  }
  void upd(int v) {
    push(v);
    if (v < arr.size() / 2) {
      push(2 * v);
      push(2 * v + 1);
      arr[v] = max(arr[2 * v], arr[2 * v + 1]);
    }
  }
  void segadd(int l, int r, int cl, int cr, int v, int x) {
    if (r <= cl || cr <= l) return;
    if (l <= cl && cr <= r) {
      laz[v] += x;
      return;
    }
    push(v);
    int ct = (cl + cr) / 2;
    segadd(l, r, cl, ct, 2 * v, x);
    segadd(l, r, ct, cr, 2 * v + 1, x);
    upd(v);
  }

 public:
  segtreei(const vector<int> &val)
      : arr(2 * up(val.size())), laz(2 * up(val.size())) {
    copy(val.begin(), val.end(), arr.begin() + arr.size() / 2);
    for (int i = (int)arr.size() / 2 - 1; i > 0; i--)
      arr[i] = max(arr[2 * i], arr[2 * i + 1]);
  }
  [[nodiscard]] int segmax(int l, int r) {
    return segmax(l, r, 0, arr.size() / 2, 1);
  }
  void segadd(int l, int r, int x) { segadd(l, r, 0, arr.size() / 2, 1, x); }
  [[nodiscard]] int segmax() {
    return segmax(0, arr.size() / 2, 0, arr.size() / 2, 1);
  }
  void set(int wh, const int &x) {
    wh += arr.size() / 2;
    arr[wh] = x;
    while ((wh >>= 1) > 0) arr[wh] = max(arr[2 * wh], arr[2 * wh + 1]);
  }
};
void build(vector<int> &gr, vector<int> &le, vector<int> &ri,
           const segtreepii &st, int l, int r, int d = 0) {
  if (r <= l) return;
  auto v = st.segmin(l, r);
  auto t = v.second;
  gr[t] = d;
  le[t] = l - 1;
  ri[t] = r;
  build(gr, le, ri, st, l, t, d + 1);
  build(gr, le, ri, st, t + 1, r, d + 1);
}
void solve(istream &cin = std::cin, ostream &cout = std::cout) {
  int n;
  cin >> n;
  vector<pair<int, int>> arr(n);
  int sh = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].first--;
    arr[i].second = i;
    if (arr[i].first == 0) sh = i;
  }
  for (auto &it : arr) {
    it.second -= sh;
    if (it.second < 0) it.second += n;
  }
  rotate(arr.begin(), arr.begin() + sh, arr.end());
  segtreepii st(arr);
  vector<int> tr(n);
  vector<int> le(n, -1), ri(n, -1);
  build(tr, le, ri, st, 0, n);
  segtreei dep(tr);
  pair<int, int> ans = {dep.segmax(), sh};
  for (int p = n - 1; p > 0; p--) {
    dep.segadd(le[p] + 1, p, -1);
    dep.segadd(p, p + 1,
               -dep.segmax(p, p + 1) + dep.segmax(ri[p], ri[p] + 1) + 1);
    if (ri[p] > p)
      dep.segadd(p + 1, ri[p], 1);
    else {
      dep.segadd(p + 1, n, 1);
      assert(ri[p] == 0);
    }
    sh--;
    ans = min(ans, {dep.segmax(), sh});
  }
  if (ans.second < 0) ans.second += n;
  cout << ans.first + 1 << ' ' << ans.second << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed;
  solve();
  return 0;
}