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;
class SegTree {
 public:
  SegTree(int _n) : n(_n) {
    x = vector<int>(_n * 4);
    y = vector<int>(_n * 4);
  }
  void PushDown(int t, int l, int r) {
    if (l == r) return;
    if (y[t] == 0) return;
    x[t + t] += y[t];
    y[t + t] += y[t];
    x[t + t + 1] += y[t];
    y[t + t + 1] += y[t];
    y[t] = 0;
  }
  void Insert(int t, int a, int l, int r, int p, int q) {
    PushDown(t, l, r);
    if (p <= l && r <= q) {
      x[t] += a;
      y[t] += a;
      return;
    }
    int mid = (l + r) >> 1;
    if (p <= mid) Insert(t + t, a, l, mid, p, q);
    if (mid + 1 <= q) Insert(t + t + 1, a, mid + 1, r, p, q);
    x[t] = max(x[t + t], x[t + t + 1]);
  }
  int Query(int t, int l, int r, int p, int q) {
    PushDown(t, l, r);
    if (p <= l && r <= q) return x[t];
    int mid = (l + r) >> 1;
    int ans = 0;
    if (p <= mid) ans = max(ans, Query(t + t, l, mid, p, q));
    if (mid + 1 <= q) ans = max(ans, Query(t + t + 1, mid + 1, r, p, q));
    return ans;
  }
  int n;
  vector<int> x, y;
};
int Find(deque<pair<int, int>>& q, int v) {
  if (q.back().first < v) return q.back().second;
  int L = 0, R = q.size() - 1;
  while (L + 1 < R) {
    int mid = (L + R) >> 1;
    if (q[mid].first < v)
      L = mid;
    else
      R = mid;
  }
  return q[L].second;
}
const int MAXN = 200010;
vector<pair<int, int>> rp[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> ox(n);
  for (int i = 0; i < n; ++i) cin >> ox[i];
  vector<int> x{0};
  for (int i = 0; i < n; ++i) {
    if (ox[i] != 1) continue;
    for (int j = i + 1; j < n; ++j) x.push_back(ox[j]);
    for (int j = 0; j <= i; ++j) x.push_back(ox[j]);
    break;
  }
  deque<pair<int, int>> fq, bq;
  for (int i = 1; i <= n; ++i) {
    while (!fq.empty() && fq.back().first > x[i]) {
      fq.pop_back();
    }
    fq.push_back({x[i], i});
  }
  for (int i = n; i >= 1; --i) {
    while (!bq.empty() && bq.back().first > x[i]) {
      rp[i].push_back(bq.back());
      bq.pop_back();
    }
    reverse(rp[i].begin(), rp[i].end());
    bq.push_back({x[i], i});
  }
  SegTree tree(n + n);
  vector<int> p(n + 1);
  for (int i = 1; i <= n; ++i) {
    p[x[i]] = i;
  }
  set<int> s;
  s.insert(0);
  s.insert(n + 1);
  for (int i = 1; i <= n; ++i) {
    auto ib = s.lower_bound(p[i]);
    auto ia = ib;
    --ia;
    tree.Insert(1, 1, 1, n + n, *ia + 1, *ib - 1);
    s.insert(p[i]);
  }
  int ans = tree.Query(1, 1, n + n, 1, n), ansp = x[1];
  for (int i = 1; i < n; ++i) {
    int p = Find(bq, x[i]);
    tree.Insert(1, -1, 1, n + n, i + 1, p - 1);
    if (bq.back().second == i) bq.pop_back();
    for (auto j : rp[i]) bq.push_back(j);
    while (!fq.empty() && fq.back().first > x[i]) {
      fq.pop_back();
    }
    fq.push_back({x[i], n + i});
    int q = Find(fq, x[i]);
    int dep = tree.Query(1, 1, n + n, q, q);
    tree.Insert(1, 1, 1, n + n, q + 1, n + i - 1);
    tree.Insert(1, dep + 1, 1, n + n, n + i, n + i);
    int temp = tree.Query(1, 1, n + n, i + 1, n + i);
    if (temp < ans) {
      ans = temp;
      ansp = x[i + 1];
    }
  }
  cout << ans << " ";
  for (int i = 0; i < n; ++i) {
    if (ox[i] == ansp) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}