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;
namespace output {
void __(short x) { cout << x; }
void __(unsigned x) { cout << x; }
void __(int x) { cout << x; }
void __(long long x) { cout << x; }
void __(unsigned long long x) { cout << x; }
void __(double x) { cout << x; }
void __(long double x) { cout << x; }
void __(char x) { cout << x; }
void __(const char* x) { cout << x; }
void __(const string& x) { cout << x; }
void __(bool x) { cout << (x ? "true" : "false"); }
template <class S, class T>
void __(const pair<S, T>& x) {
  __(1 ? "(" : ""), __(x.first), __(1 ? ", " : " "), __(x.second),
      __(1 ? ")" : "");
}
template <class T>
void __(const vector<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class T>
void __(const set<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class T>
void __(const multiset<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class S, class T>
void __(const map<S, T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
void pr() { cout << "\n"; }
template <class S, class... T>
void pr(const S& a, const T&... b) {
  __(a);
  if (sizeof...(b)) __(' ');
  pr(b...);
}
}  // namespace output
using namespace output;
const int MN = 2e5 + 5;
int n, ans, sh, i, x, arr[MN], st[3 * MN], id[3 * MN], dp[3 * MN], lz[3 * MN],
    p[MN], l[MN], r[MN], f, s;
void build(int i, int s, int e) {
  if (s != e) {
    build(2 * i, s, (s + e) / 2);
    build(2 * i + 1, (s + e) / 2 + 1, e);
    id[i] = (st[2 * i] > st[2 * i + 1]) ? id[2 * i] : id[2 * i + 1];
    st[i] = max(st[2 * i], st[2 * i + 1]);
  } else
    st[i] = -arr[s], id[i] = s;
}
pair<int, int> qu(int i, int s, int e, int ss, int se) {
  if (s >= ss && e <= se)
    return make_pair(st[i], id[i]);
  else if ((s + e) / 2 < ss)
    return qu(2 * i + 1, (s + e) / 2 + 1, e, ss, se);
  else if ((s + e) / 2 >= se)
    return qu(2 * i, s, (s + e) / 2, ss, se);
  else {
    pair<int, int> l = qu(2 * i, s, (s + e) / 2, ss, se),
                   r = qu(2 * i + 1, (s + e) / 2 + 1, e, ss, se);
    return l.first > r.first ? l : r;
  }
}
inline void upd_lz(int i, int s, int e) {
  if (lz[i]) {
    dp[i] += lz[i];
    if (s != e) lz[2 * i] += lz[i], lz[2 * i + 1] += lz[i];
    lz[i] = 0;
  }
}
void upd(int i, int s, int e, int ss, int se, int val) {
  if (ss > se) return;
  upd_lz(i, s, e);
  if (s >= ss && e <= se) {
    lz[i] = val;
    upd_lz(i, s, e);
  } else {
    if ((s + e) / 2 < ss) {
      upd_lz(2 * i, s, (s + e) / 2);
      upd(2 * i + 1, (s + e) / 2 + 1, e, ss, se, val);
    } else if ((s + e) / 2 >= se) {
      upd_lz(2 * i + 1, (s + e) / 2 + 1, e);
      upd(2 * i, s, (s + e) / 2, ss, se, val);
    } else {
      upd(2 * i, s, (s + e) / 2, ss, se, val);
      upd(2 * i + 1, (s + e) / 2 + 1, e, ss, se, val);
    }
    dp[i] = max(dp[2 * i], dp[2 * i + 1]);
  }
}
int qur(int i, int s, int e, int ss, int se) {
  upd_lz(i, s, e);
  if (s >= ss && e <= se)
    return dp[i];
  else if ((s + e) / 2 < ss)
    return qur(2 * i + 1, (s + e) / 2 + 1, e, ss, se);
  else if ((s + e) / 2 >= se)
    return qur(2 * i, s, (s + e) / 2, ss, se);
  else
    return max(qur(2 * i, s, (s + e) / 2, ss, se),
               qur(2 * i + 1, (s + e) / 2 + 1, e, ss, se));
}
int init(int s, int e, int d) {
  if (s > e) return 0;
  int rt = qu(1, 1, n, s, e).second;
  upd(1, 1, n, rt, rt, d);
  int ls = init(s, rt - 1, d + 1), rs = init(rt + 1, e, d + 1);
  p[ls] = p[rs] = rt;
  l[rt] = ls, r[rt] = rs;
  return rt;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  build(1, 1, n);
  init(1, n, 1);
  ans = qur(1, 1, n, 1, n);
  int lst = 1;
  for (i = 0; i < n - 1; i++) {
    if (!p[n - i])
      upd(1, 1, n, 1, n, -1);
    else if (p[n - i] <= n - i)
      upd(1, 1, n, p[n - i] + 1, n - i - 1, -1);
    else
      upd(1, 1, n, p[n - i] + 1, n, -1), upd(1, 1, n, 1, n - i - 1, -1);
    upd(1, 1, n, n - i, n - i, -qur(1, 1, n, n - i, n - i));
    r[p[n - i]] = l[n - i];
    p[l[n - i]] = p[n - i];
    l[n - i] = 0;
    int c = lst;
    while (arr[c] > arr[n - i] && p[c]) c = p[c];
    if (arr[c] > arr[n - i]) {
      upd(1, 1, n, 1, n, 1);
      p[n - i] = 0;
      r[n - i] = c;
      p[c] = n - i;
    } else {
      p[n - i] = c;
      r[n - i] = l[c];
      l[c] = n - i;
      p[r[n - i]] = n - i;
      upd(1, 1, n, n - i, n - i, qur(1, 1, n, c, c) + 1);
      if (c >= n - i)
        upd(1, 1, n, n - i + 1, c - 1, 1);
      else
        upd(1, 1, n, n - i + 1, n, 1), upd(1, 1, n, 1, c - 1, 1);
    }
    int tmp = qur(1, 1, n, 1, n);
    if (tmp < ans) {
      ans = tmp;
      sh = n - i - 1;
    }
    lst = n - i;
  }
  printf("%d %d\n", ans, sh);
  return 0;
}