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>
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxM = 262144;
const int mxN = 200001;
int sgmax[4 * mxM];
int del[4 * mxM];
int n;
int arr[2 * mxN];
int p[2 * mxN];
int to[2 * mxN];
int prv[2 * mxN];
void push(int i) {
  del[2 * i] += del[i];
  del[2 * i + 1] += del[i];
  del[i] = 0;
}
void resolve(int i) {
  sgmax[i] = max(sgmax[2 * i] + del[2 * i], sgmax[2 * i + 1] + del[2 * i + 1]);
}
void init(int i = 1, int l = 0, int r = 2 * n - 1) {
  del[i] = 0;
  if (l == r) {
    sgmax[i] = arr[l];
    return;
  }
  int mid = (l + r) >> 1;
  init(2 * i, l, mid);
  init(2 * i + 1, mid + 1, r);
  resolve(i);
}
void upd(int l, int r, int ch, int i = 1, int le = 0, int rr = 2 * n - 1) {
  if (r < l) {
    return;
  }
  r = min(r, 2 * n - 1);
  if (rr < l || le > r) {
    return;
  }
  if (le >= l && rr <= r) {
    del[i] += ch;
    return;
  }
  push(i);
  int mid = (le + rr) >> 1;
  upd(l, r, ch, 2 * i, le, mid);
  upd(l, r, ch, 2 * i + 1, mid + 1, rr);
  resolve(i);
}
int qmax(int l, int r, int i = 1, int le = 0, int rr = 2 * n - 1) {
  if (rr < l || le > r) return 0;
  if (le >= l && rr <= r) return sgmax[i] + del[i];
  push(i);
  resolve(i);
  int mid = (le + rr) >> 1;
  return max(qmax(l, r, 2 * i, le, mid), qmax(l, r, 2 * i + 1, mid + 1, rr));
}
vector<int> comp(int *p) {
  init();
  vector<int> res(n);
  vector<int> sv(n + 1);
  for (int i = (0); i < (n); ++i) {
    int tt = qmax(0, p[i] - 1);
    res[i] = sv[tt] + 1;
    upd(p[i], p[i], i + 1);
    sv[i + 1] = res[i];
  }
  return res;
}
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> p[i];
    p[i + n] = p[i];
  }
  vector<int> left = comp(p);
  reverse(p, p + n);
  vector<int> right = comp(p);
  reverse(right.begin(), right.end());
  reverse(p, p + n);
  for (int i = (0); i < (n); ++i) {
    arr[i] = left[i] + right[i] - 1;
  }
  set<int> curr;
  for (int i = (0); i < (2 * n); ++i) {
    auto it = curr.lower_bound(p[i]);
    while (it != curr.end()) {
      to[*it] = i;
      it = curr.erase(it);
    }
    if (i < n) {
      curr.insert(p[i]);
    }
  }
  curr.clear();
  for (int i = (2 * n) - 1; i >= (0); --i) {
    auto it = curr.lower_bound(p[i]);
    while (it != curr.end()) {
      prv[*it] = i;
      it = curr.erase(it);
    }
    if (i >= n) {
      curr.insert(p[i]);
    }
  }
  init();
  pair<int, int> ans = {qmax(0, n - 1), 0};
  for (int i = (0); i < (n - 1); ++i) {
    upd(i, to[p[i]] - 1, -1);
    upd(i + n, i + n, qmax(prv[p[i]], prv[p[i]]));
    upd(prv[p[i]] + 1, i + n, 1);
    ans = min(ans, {qmax(i + 1, n + i), i + 1});
  }
  cout << ans.first << " " << ans.second << "\n";
  return 0;
}