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;
const int N = (int)2e5 + 7;
struct SegmentTree {
  int a[N << 2], lazy[N << 2];
  inline void pull(int rt) { a[rt] = max(a[rt << 1], a[rt << 1 | 1]); }
  inline void push(int rt) {
    if (lazy[rt]) {
      a[rt << 1] += lazy[rt];
      a[rt << 1 | 1] += lazy[rt];
      lazy[rt << 1] += lazy[rt];
      lazy[rt << 1 | 1] += lazy[rt];
      lazy[rt] = 0;
    }
  }
  void build(int *depth, int l, int r, int rt) {
    if (l == r) {
      a[rt] = depth[l];
      return;
    }
    int mid = l + r >> 1;
    build(depth, l, mid, rt << 1);
    build(depth, mid + 1, r, rt << 1 | 1);
    pull(rt);
  }
  void update(int L, int R, int val, int l, int r, int rt) {
    if (R < l || r < L || R < L) return;
    if (L <= l && r <= R) {
      a[rt] += val;
      lazy[rt] += val;
      return;
    }
    push(rt);
    int mid = l + r >> 1;
    update(L, R, val, l, mid, rt << 1);
    update(L, R, val, mid + 1, r, rt << 1 | 1);
    pull(rt);
  }
  void update2(int p, int val, int l, int r, int rt) {
    if (l == r) {
      a[rt] = val;
      return;
    }
    push(rt);
    int mid = l + r >> 1;
    if (p <= mid)
      update2(p, val, l, mid, rt << 1);
    else
      update2(p, val, mid + 1, r, rt << 1 | 1);
    pull(rt);
  }
  int query(int L, int R, int l, int r, int rt) {
    if (R < l || r < L || R < L) return 0;
    if (L <= l && r <= R) return a[rt];
    push(rt);
    int mid = l + r >> 1;
    return max(query(L, R, l, mid, rt << 1),
               query(L, R, mid + 1, r, rt << 1 | 1));
  }
} Tree;
int n;
int a[N << 1];
int stk[N << 1], top;
int L[N << 1], R[N << 1];
int ls[N], rs[N];
bool vis[N];
int depth[N];
void dfs(int u, int dep) {
  depth[u] = dep;
  if (ls[u]) dfs(ls[u], dep + 1);
  if (rs[u]) dfs(rs[u], dep + 1);
}
void modify(int l, int r, int val) {
  if (l > r) return;
  if (l > n) l -= n;
  if (r > n) r -= n;
  if (l <= r)
    Tree.update(l, r, val, 1, n, 1);
  else {
    Tree.update(1, r, val, 1, n, 1);
    Tree.update(l, n, val, 1, n, 1);
  }
}
void show() {
  for (int i = 1; i <= n; i++) printf("%d: %d\n", i, Tree.query(i, i, 1, n, 1));
  puts("");
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  top = 0;
  for (int i = 1; i <= n * 2; i++) {
    while (top && a[stk[top]] > a[i]) top--;
    L[i] = top ? stk[top] : 0;
    stk[++top] = i;
  }
  top = 0;
  for (int i = n * 2; i >= 1; i--) {
    while (top && a[stk[top]] > a[i]) top--;
    R[i] = top ? stk[top] : (n * 2 + 1);
    stk[++top] = i;
  }
  top = 0;
  for (int i = 1; i <= n; i++) {
    int tmp = top;
    while (top && a[stk[tmp]] > a[i]) tmp--;
    if (tmp) rs[stk[tmp]] = i;
    if (tmp < top) ls[i] = stk[tmp + 1];
    stk[++tmp] = i;
    top = tmp;
  }
  for (int i = 1; i <= n; i++) vis[ls[i]] = vis[rs[i]] = true;
  int Rt = -1;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) Rt = i;
  dfs(Rt, 1);
  Tree.build(depth, 1, n, 1);
  pair<int, int> ans = make_pair(Tree.query(1, n, 1, n, 1), 0);
  for (int i = 1; i < n; i++) {
    int l = i + 1;
    int r = min(R[i], i + n) - 1;
    modify(l, r, -1);
    r = i + n - 1;
    l = max(i, L[i + n]) + 1;
    modify(l, r, 1);
    int pos = (l - 1) > n ? (l - 1 - n) : (l - 1);
    int now_depth = (l - 1 <= i) ? 1 : (Tree.query(pos, pos, 1, n, 1) + 1);
    Tree.update2(i, now_depth, 1, n, 1);
    ans = min(ans, make_pair(Tree.query(1, n, 1, n, 1), i));
  }
  printf("%d %d\n", ans.first, ans.second);
  return 0;
}