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 MN = 400001;
pair<int, int> t[MN * 4];
int sm[MN * 4];
int p[MN * 4];
int ar[MN];
int vec[MN];
int pmi[MN][2];
int pos[MN];
void build1(int v, int l, int r) {
  if (l >= r) {
    t[v] = {MN, MN};
  }
  if (l + 1 == r) {
    t[v] = {ar[l], l};
    return;
  }
  int m = (l + r) / 2;
  build1(v * 2, l, m);
  build1(v * 2 + 1, m, r);
  t[v] = min(t[v * 2], t[v * 2 + 1]);
}
pair<int, int> un(pair<int, int> a, pair<int, int> b) {
  auto [l1, r1] = a;
  auto [l2, r2] = b;
  pair<int, int> c;
  if (l1 == -1)
    c.first = l2;
  else if (l2 == -1)
    c.first = l1;
  else if (vec[l1] == vec[l2]) {
    c.first = min(l1, l2);
  } else if (vec[l1] > vec[l2]) {
    c.first = l1;
  } else {
    c.first = l2;
  }
  if (r1 == -1)
    c.second = r2;
  else if (r2 == -1)
    c.second = r1;
  else if (vec[r1] == vec[r2]) {
    c.second = max(r1, r2);
  } else if (vec[r1] > vec[r2]) {
    c.second = r1;
  } else {
    c.second = r2;
  }
  return c;
}
void build3(int v, int l, int r) {
  if (l >= r) {
    t[v] = {-1, -1};
  }
  if (l + 1 == r) {
    t[v] = {l, l};
    return;
  }
  int m = (l + r) / 2;
  build3(v * 2, l, m);
  build3(v * 2 + 1, m, r);
  t[v] = un(t[v * 2], t[v * 2 + 1]);
}
void build2(int v, int l, int r) {
  if (l >= r) {
    sm[v] = 0;
  }
  if (l + 1 == r) {
    sm[v] = ar[l];
    return;
  }
  int m = (l + r) / 2;
  build2(v * 2, l, m);
  build2(v * 2 + 1, m, r);
  sm[v] = max(sm[v * 2], sm[v * 2 + 1]);
}
pair<int, int> get1(int v, int l, int r, int lf, int rf) {
  if (l >= rf || lf >= r) {
    return {MN, MN};
  }
  if (l >= lf && r <= rf) {
    return t[v];
  }
  int m = (l + r) / 2;
  return min(get1(v * 2, l, m, lf, rf), get1(v * 2 + 1, m, r, lf, rf));
}
pair<int, int> get3(int v, int l, int r, int lf, int rf) {
  if (l >= rf || lf >= r) {
    return {-1, -1};
  }
  if (l >= lf && r <= rf) {
    return t[v];
  }
  int m = (l + r) / 2;
  return un(get3(v * 2, l, m, lf, rf), get3(v * 2 + 1, m, r, lf, rf));
}
void st(int v, int l, int r, int lf, int rf) {
  if (l >= rf || lf >= r) {
    return;
  }
  if (l >= lf && r <= rf) {
    vec[l] = 1;
    return;
  }
  int m = (l + r) / 2;
  st(v * 2, l, m, lf, rf);
  st(v * 2 + 1, m, r, lf, rf);
  t[v] = un(t[v * 2], t[v * 2 + 1]);
}
int get2(int v, int l, int r, int lf, int rf) {
  if (l >= rf || lf >= r) {
    return -MN;
  }
  if (l >= lf && r <= rf) {
    return sm[v] + p[v];
  }
  int m = (l + r) / 2;
  return max(get2(v * 2, l, m, lf, rf), get2(v * 2 + 1, m, r, lf, rf)) + p[v];
}
void add(int v, int l, int r, int lf, int rf, int x) {
  if (lf >= rf) {
    return;
  }
  if (l >= rf || lf >= r) {
    return;
  }
  if (l >= lf && r <= rf) {
    p[v] += x;
    return;
  }
  int m = (l + r) / 2;
  add(v * 2, l, m, lf, rf, x);
  add(v * 2 + 1, m, r, lf, rf, x);
  sm[v] = max(sm[v * 2] + p[v * 2], sm[v * 2 + 1] + p[v * 2 + 1]);
}
void dfs(int l, int r, int d = 0) {
  if (l == r) {
    return;
  }
  auto [m, ind] = get1(1, 0, MN, l, r);
  ar[ind] = d;
  dfs(l, ind, d + 1);
  dfs(ind + 1, r, d + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int v[n * 2];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    ar[i + n] = ar[i];
    v[i] = ar[i];
    v[i + n] = v[i];
    pos[ar[i]] = i;
  }
  build1(1, 0, MN);
  for (int i = 0; i < n * 2; i++) {
    ar[i] = 0;
  }
  dfs(0, n);
  build2(1, 0, MN);
  int ans = get2(1, 0, MN, 0, n);
  int ind = 0;
  build3(1, 0, MN);
  for (int i = 1; i <= n; i++) {
    int j = pos[i];
    st(1, 0, MN, j, j + 1);
    st(1, 0, MN, j + n, j + n + 1);
    if (j == 0) {
      pmi[j][0] = -1;
    } else {
      pmi[j][0] = get3(1, 0, MN, 0, j).second;
      if (!vec[pmi[j][0]]) pmi[j][0] = -1;
    }
    if (j == 2 * n - 1) {
      pmi[j][1] = -1;
    } else {
      pmi[j][1] = get3(1, 0, MN, j + 1, n * 2).first;
      if (!vec[pmi[j][1]]) pmi[j][1] = -1;
    }
    j += n;
    if (j == 0) {
      pmi[j][0] = -1;
    } else {
      pmi[j][0] = get3(1, 0, MN, 0, j).second;
      if (!vec[pmi[j][0]]) pmi[j][0] = -1;
    }
    if (j == 2 * n - 1) {
      pmi[j][1] = -1;
    } else {
      pmi[j][1] = get3(1, 0, MN, j + 1, n * 2).first;
      if (!vec[pmi[j][1]]) pmi[j][1] = MN;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    add(1, 0, MN, i, pmi[i][1], -1);
    auto x = get2(1, 0, MN, pmi[i + n][0], pmi[i + n][0] + 1);
    add(1, 0, MN, i + n, i + n + 1, x + 1);
    add(1, 0, MN, pmi[i + n][0] + 1, i + n, 1);
    x = get2(1, 0, MN, i + 1, i + 1 + n);
    if (x < ans) {
      ans = x;
      ind = i + 1;
    }
  }
  cout << ans + 1 << ' ' << ind;
}