#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
  return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
  o << "{";
  for (const T& v : vc) o << v << ",";
  o << "}";
  return o;
}
using ll = long long;
template <class T>
using V = vector<T>;
template <class T>
using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
struct segtree {
  using D = int;
  D inf = 1e9;
  using P = pair<D, int>;
  int N;
  vector<P> val;
  segtree() {}
  segtree(int n) {
    N = 1;
    while (N < n) N *= 2;
    val.assign(N * 2, P(inf, -1));
    for (int i = 0; i < (int)(n); i++) val[i + N].second = i;
    for (int i = N - 1; i > 0; i--) val[i] = min(val[i * 2], val[i * 2 + 1]);
  }
  segtree(const vector<D>& ds) {
    int n = ds.size();
    N = 1;
    while (N < n) N *= 2;
    val.assign(N * 2, P(inf, -1));
    for (int i = 0; i < (int)(n); i++) val[i + N] = P(ds[i], i);
    for (int i = N - 1; i > 0; i--) val[i] = min(val[i * 2], val[i * 2 + 1]);
  }
  void assign(int k, D d) {
    k += N;
    val[k] = P(d, k - N);
    k /= 2;
    while (k) {
      val[k] = min(val[k * 2], val[k * 2 + 1]);
      k /= 2;
    }
  }
  P getmina(int a, int b) {
    P res = P(inf, -1);
    a += N, b += N;
    while (a < b) {
      if (a & 1) res = min(res, val[a++]);
      if (b & 1) res = min(res, val[--b]);
      a /= 2, b /= 2;
    }
    return res;
  }
};
V<int> solve(V<int> p) {
  int N = p.size();
  int rot = 0;
  {
    for (int i = 0; i < (int)(N); i++)
      if (p[i] == 0) {
        rot = i + 1;
        break;
      }
    rotate(p.begin(), p.begin() + rot, p.end());
  }
  true;
  segtree seg(p);
  V<int> depth(N, -1);
  V<int> lch(N, -1), rch(N, -1);
  function<int(int, int, int)> dfs = [&](int l, int r, int p) {
    if (l >= r) return -1;
    int m = seg.getmina(l, r).second;
    if (p != -1 && p > m) lch[p] = m;
    if (p != -1 && p < m) rch[p] = m;
    depth[m] = max(depth[m], dfs(l, m, m) + 1);
    depth[m] = max(depth[m], dfs(m + 1, r, m) + 1);
    return depth[m];
  };
  dfs(0, N, -1);
  V<int> A(N);
  for (int i = 0; i < (int)(N); i++)
    if (rch[i] != -1) A[i] = 1 + depth[rch[i]];
  V<int> chain;
  multiset<int> st;
  for (int v = 0; v < (int)(N); v++) {
    true;
    true;
  }
  {
    for (int x = N - 1, d = 0; x != -1; x = lch[x], d++) {
      chain.push_back(x);
      st.insert(A[x] + d);
    }
  }
  V<int> res(N);
  for (int i = 0; i < (int)(N); i++) {
    res[i] = *st.rbegin();
    if (i != N - 1) {
      assert(chain.back() == i);
      {
        int er = A[i] + (int)chain.size() - 1;
        auto it = st.find(er);
        assert(it != st.end());
        st.erase(it);
        chain.pop_back();
      }
      for (int x = rch[i]; x != -1; x = lch[x]) {
        int ad = A[x] + (int)chain.size();
        st.insert(ad);
        chain.push_back(x);
      }
    }
  }
  rotate(res.begin(), res.begin() + N - rot, res.end());
  true;
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  V<int> p(N);
  for (int i = 0; i < (int)(N); i++) cin >> p[i], p[i]--;
  V<int> a = solve(p);
  reverse(p.begin(), p.end());
  V<int> b = solve(p);
  int ag = 0;
  for (int i = 0; i < (int)(N); i++) {
    if (max(a[i], b[(N - i) % N]) < max(a[ag], b[(N - ag) % N])) ag = i;
  }
  cout << max(a[ag], b[(N - ag) % N]) + 1 << " " << ag << endl;
}
