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;
int seg_tree_f[400000 * 4 + 9];
int lazy_f[400000 * 4 + 9];
void init_tree_f(int node, int beg, int end) {
  if (beg == end) {
    seg_tree_f[node] = 0;
    lazy_f[node] = 0;
    return;
  }
  int mid = (beg + end) >> 1;
  init_tree_f((node << 1), beg, mid);
  init_tree_f((node << 1) | 1, mid + 1, end);
  seg_tree_f[node] = 0;
  lazy_f[node] = 0;
}
inline void split_node_f(int node) {
  if (lazy_f[node] == 0) return;
  seg_tree_f[(node << 1)] += lazy_f[node];
  lazy_f[(node << 1)] += lazy_f[node];
  seg_tree_f[(node << 1) | 1] += lazy_f[node];
  lazy_f[(node << 1) | 1] += lazy_f[node];
  lazy_f[node] = 0;
}
inline void merge_node_f(int node) {
  seg_tree_f[node] = min(seg_tree_f[(node << 1)], seg_tree_f[(node << 1) | 1]);
}
void update_f(int node, int beg, int end, int i, int j, int value) {
  if (beg > j || end < i) return;
  if (beg >= i && end <= j) {
    seg_tree_f[node] += value;
    lazy_f[node] += value;
    return;
  }
  split_node_f(node);
  int mid = (beg + end) >> 1;
  update_f((node << 1), beg, mid, i, j, value);
  update_f((node << 1) | 1, mid + 1, end, i, j, value);
  merge_node_f(node);
}
int query_f_leftmost(int node, int beg, int end, int i, int j, int target) {
  if (i > end || j < beg) return (1 << 30);
  if (seg_tree_f[node] > target) return (1 << 30);
  if (beg == end) return beg;
  split_node_f(node);
  int mid = (beg + end) >> 1;
  int ind = query_f_leftmost((node << 1), beg, mid, i, j, target);
  if (ind != (1 << 30)) return ind;
  return query_f_leftmost(((node << 1) | 1), mid + 1, end, i, j, target);
}
int query_f_rightmost(int node, int beg, int end, int i, int j, int target) {
  if (i > end || j < beg) return (-(1 << 30));
  if (seg_tree_f[node] > target) return (-(1 << 30));
  if (beg == end) return beg;
  split_node_f(node);
  int mid = (beg + end) >> 1;
  int ind = query_f_rightmost(((node << 1) | 1), mid + 1, end, i, j, target);
  if (ind != (-(1 << 30))) return ind;
  return query_f_rightmost((node << 1), beg, mid, i, j, target);
}
int query_f(int node, int beg, int end, int i, int j) {
  if (i > end || j < beg) return (1LL << 30);
  if (beg >= i && end <= j) return seg_tree_f[node];
  split_node_f(node);
  int mid = (beg + end) >> 1;
  int leftnode = query_f((node << 1), beg, mid, i, j);
  int rightnode = query_f(((node << 1) | 1), mid + 1, end, i, j);
  return min(leftnode, rightnode);
}
int seg_tree[400000 * 4 + 9];
int lazy[400000 * 4 + 9];
void init_tree(int node, int beg, int end) {
  if (beg == end) {
    seg_tree[node] = 0;
    lazy[node] = 0;
    return;
  }
  int mid = (beg + end) >> 1;
  init_tree((node << 1), beg, mid);
  init_tree((node << 1) | 1, mid + 1, end);
  seg_tree[node] = 0;
  lazy[node] = 0;
}
void split_node(int node) {
  if (lazy[node] == 0) return;
  seg_tree[(node << 1)] += lazy[node];
  lazy[(node << 1)] += lazy[node];
  seg_tree[(node << 1) | 1] += lazy[node];
  lazy[(node << 1) | 1] += lazy[node];
  lazy[node] = 0;
}
void merge_node(int node) {
  seg_tree[node] = max(seg_tree[(node << 1)], seg_tree[(node << 1) | 1]);
}
void update(int node, int beg, int end, int i, int j, int value) {
  if (beg > j || end < i) return;
  if (beg >= i && end <= j) {
    seg_tree[node] += value;
    lazy[node] += value;
    return;
  }
  split_node(node);
  int mid = (beg + end) >> 1;
  update((node << 1), beg, mid, i, j, value);
  update((node << 1) | 1, mid + 1, end, i, j, value);
  merge_node(node);
}
int query_leftmost(int node, int beg, int end, int i, int j, int target) {
  if (i > end || j < beg) return (1 << 30);
  if (seg_tree[node] < target) return (1 << 30);
  if (beg == end) return beg;
  split_node(node);
  int mid = (beg + end) >> 1;
  int ind = query_leftmost((node << 1), beg, mid, i, j, target);
  if (ind != (1 << 30)) return ind;
  return query_leftmost(((node << 1) | 1), mid + 1, end, i, j, target);
}
int query_rightmost(int node, int beg, int end, int i, int j, int target) {
  if (i > end || j < beg) return (-(1 << 30));
  if (seg_tree[node] < target) return (-(1 << 30));
  if (beg == end) return beg;
  split_node(node);
  int mid = (beg + end) >> 1;
  int ind = query_rightmost(((node << 1) | 1), mid + 1, end, i, j, target);
  if (ind != (-(1 << 30))) return ind;
  return query_rightmost((node << 1), beg, mid, i, j, target);
}
int query(int node, int beg, int end, int i, int j) {
  if (i > end || j < beg) return (-(1LL << 30));
  if (beg >= i && end <= j) return seg_tree[node];
  split_node(node);
  int mid = (beg + end) >> 1;
  int leftnode = query((node << 1), beg, mid, i, j);
  int rightnode = query(((node << 1) | 1), mid + 1, end, i, j);
  return max(leftnode, rightnode);
}
int MAP[400000 + 9];
int ar[400000 + 9];
int ANC[400000 + 9];
void GO(int l, int r, int n, int carry) {
  if (l > r) return;
  int m = MAP[query_f(1, 1, n, l, r)];
  ANC[m] = carry;
  GO(l, m - 1, n, carry + 1);
  GO(m + 1, r, n, carry + 1);
}
int main() {
  int i, j, k, l, cas, ne, test, n, m, x, y, temp, val, now, q, w, e, root,
      flag, ii, o, p, ans, r;
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%d", &ar[i]);
  for (i = 1; i <= n; i++) MAP[ar[i]] = i;
  init_tree_f(1, 1, n);
  for (i = 1; i <= n; i++) update_f(1, 1, n, i, i, ar[i]);
  GO(1, n, n, 0);
  init_tree_f(1, 1, 2 * n);
  for (i = 1; i <= n; i++) ar[i + n] = ar[i];
  for (i = 1; i <= 2 * n; i++) update_f(1, 1, 2 * n, i, i, ar[i]);
  init_tree(1, 1, 2 * n);
  for (i = 1; i <= n; i++) ANC[i + n] = ANC[i];
  for (i = 1; i <= 2 * n; i++) update(1, 1, 2 * n, i, i, ANC[i]);
  ans = seg_tree[1];
  val = 0;
  for (i = 1; i < n; i++) {
    l = query_f_leftmost(1, 1, 2 * n, i + 1, n + i - 1, ar[i]);
    if (l != (1 << 30)) update(1, 1, 2 * n, i + 1, l - 1, -1);
    r = query_f_rightmost(1, 1, 2 * n, i + 1, n + i - 1, ar[i]);
    if (r != (-(1 << 30))) update(1, 1, 2 * n, r + 1, n + i - 1, 1);
    update(1, 1, 2 * n, n + i, n + i, -(query(1, 1, 2 * n, n + i, n + i)));
    if (r != (-(1 << 30)))
      update(1, 1, 2 * n, n + i, n + i, (query(1, 1, 2 * n, r, r) + 1));
    temp = query(1, 1, 2 * n, i + 1, i + n);
    if (temp < ans) {
      ans = temp;
      val = i;
    }
  }
  cout << ans + 1 << " " << val << endl;
}