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 {
 private:
  class Node {
    void merge_info() {
      if (ln != nullptr) {
        auto ldata = ln->x + ln->add;
        auto rdata = rn->x + rn->add;
        x = max(ldata, rdata);
      }
    }

   public:
    Node *ln, *rn;
    long long x, add;
    Node(long long x) {
      this->x = x;
      this->add = 0;
      this->ln = this->rn = nullptr;
    }
    Node(Node *ln, Node *rn) {
      this->add = 0;
      this->ln = ln;
      this->rn = rn;
      this->merge_info();
    }
    void norm() {
      if (ln != nullptr) {
        ln->add += add;
        rn->add += add;
      } else {
        x += add;
      }
      add = 0;
      merge_info();
    }
  };
  Node *init(vector<long long> &v, int l, int r) {
    if (l == r) return new Node(v[l]);
    int k = l + (r - l) / 2;
    Node *ln = init(v, l, k);
    Node *rn = init(v, k + 1, r);
    return new Node(ln, rn);
  }
  long long merge_query(long long *lret, long long *rret) {
    if (lret == nullptr) return *rret;
    if (rret == nullptr) return *lret;
    return max(*lret, *rret);
  }
  long long query(Node *curr, int l, int r, int i, int j) {
    curr->norm();
    if (l >= i && r <= j) return curr->x;
    int k = l + (r - l) / 2;
    long long *lret = nullptr, *rret = nullptr;
    if (k >= i && l <= j) lret = new long long(query(curr->ln, l, k, i, j));
    if (k + 1 <= j && r >= i)
      rret = new long long(query(curr->rn, k + 1, r, i, j));
    auto ret = merge_query(lret, rret);
    return ret;
  }
  void add(Node *curr, long long k, int i, int j, int l, int r) {
    if (j < l || i > r) return;
    if (l >= i && r <= j) {
      curr->add += k;
    } else {
      int m = l + (r - l) / 2;
      add(curr->ln, k, i, j, l, m);
      add(curr->rn, k, i, j, m + 1, r);
    }
    curr->norm();
  }
  int n;
  Node *root = nullptr;
  void clean(Node *v) {
    if (v == nullptr) return;
    clean(v->ln);
    clean(v->rn);
    delete v;
  }

 public:
  SegTree(vector<long long> &v) {
    this->n = v.size();
    this->root = init(v, 0, n - 1);
  }
  ~SegTree() { clean(root); }
  long long query(int i = 0, int j = -1) {
    if (j == -1) j = n - 1;
    return query(root, 0, n - 1, i, j);
  }
  void add(long long k, int i, int j = -1) {
    if (j == -1) j = n - 1;
    add(root, k, i, j, 0, n - 1);
  }
};
vector<pair<int, int>> rSteps(vector<int> &p) {
  int n = p.size(), i, j;
  int pos1 = find((p).begin(), (p).end(), 1) - p.begin();
  vector<pair<int, int>> rh(n);
  rh[pos1] = {0, 0};
  stack<pair<int, int>> d;
  d.push({1, pos1});
  j = pos1;
  for (i = 1; i < n; i++) {
    j = (j - 1 + n) % n;
    while (d.top().first > p[j]) d.pop();
    int pA = d.top().second;
    int rJ = (pA - j + n) % n;
    int hJ = pA > j ? rh[pA].second + 1 : 0;
    rh[j] = {rJ, hJ};
    d.push({p[j], j});
  }
  return rh;
}
int main() {
  int n, i;
  cin >> n;
  vector<int> p(n);
  for (i = 0; i < n; i++) cin >> p[i];
  auto rh = rSteps(p);
  reverse((p).begin(), (p).end());
  auto lh = rSteps(p);
  reverse((lh).begin(), (lh).end());
  vector<long long> v(2 * n, 0);
  for (i = 0; i < n; i++) v[i] = rh[i].second + lh[i].second;
  SegTree s(v);
  int minH = s.query(0, n - 1);
  int bestS = 0;
  for (i = 0; i < n - 1; i++) {
    int lq = i + 1, rq = i + rh[i].first - 1;
    if (lq <= rq) s.add(-1, lq, rq);
    int lI = lh[i].first;
    lq = i + n - lI + 1;
    rq = i + n - 1;
    if (lq <= rq) s.add(+1, lq, rq);
    if (lI > 0) {
      int newV = s.query(i + n - lI, i + n - lI) + 1;
      s.add(newV, i + n, i + n);
    }
    int currH = s.query(i + 1, i + n);
    if (currH < minH) {
      minH = currH;
      bestS = i + 1;
    }
  }
  cout << (minH + 1) << " " << bestS << endl;
  return 0;
}