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;
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
  i >> p.first >> p.second;
  return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
  for (auto& v : t) {
    i >> v;
  }
  return i;
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& o, const pair<T, U>& p) {
  o << p.first << ' ' << p.second;
  return o;
}
template <typename T>
std::ostream& operator<<(std::ostream& o, const vector<T>& t) {
  if (t.empty()) o << '\n';
  for (size_t i = 0; i < t.size(); ++i) {
    o << t[i] << " \n"[i == t.size() - 1];
  }
  return o;
}
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T, vector<T>, less<T>>;
unsigned int logceil(long long first) {
  return first ? 8 * sizeof(long long) - __builtin_clzll(first) : 0;
}
namespace std {
template <typename T, typename U>
struct hash<pair<T, U>> {
  hash<T> t;
  hash<U> u;
  size_t operator()(const pair<T, U>& p) const {
    return t(p.first) ^ (u(p.second) << 7);
  }
};
}  // namespace std
template <typename T, typename F>
T bsh(T l, T h, const F& f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      l = m + 1;
      r = m;
    } else {
      h = m - 1;
    }
  }
  return r;
}
template <typename F>
double bshd(double l, double h, const F& f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      l = m;
    } else {
      h = m;
    }
  }
  return (l + h) / 2;
}
template <typename T, typename F>
T bsl(T l, T h, const F& f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      h = m - 1;
      r = m;
    } else {
      l = m + 1;
    }
  }
  return r;
}
template <typename F>
double bsld(double l, double h, const F& f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      h = m;
    } else {
      l = m;
    }
  }
  return (l + h) / 2;
}
template <typename T>
T gcd(T a, T b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
template <typename T>
class vector2 : public vector<vector<T>> {
 public:
  vector2() {}
  vector2(size_t a, size_t b, T t = T())
      : vector<vector<T>>(a, vector<T>(b, t)) {}
};
template <typename T>
class vector3 : public vector<vector2<T>> {
 public:
  vector3() {}
  vector3(size_t a, size_t b, size_t c, T t = T())
      : vector<vector2<T>>(a, vector2<T>(b, c, t)) {}
};
template <typename T>
class vector4 : public vector<vector3<T>> {
 public:
  vector4() {}
  vector4(size_t a, size_t b, size_t c, size_t d, T t = T())
      : vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {}
};
template <typename T>
class vector5 : public vector<vector4<T>> {
 public:
  vector5() {}
  vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T())
      : vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {}
};
template <typename T, typename Op>
class ConstTree {
 public:
  explicit ConstTree(const vector<T>& V)
      : D(logceil(int(V.size()))), N(V.size()), A{V}, L(N, 0) {
    for (unsigned int b = 1; b < D; ++b) {
      A.emplace_back(N - (1 << b) + 1);
      for (unsigned int i = 0; i + (1 << b) <= N; ++i) {
        A[b][i] = op(A[b - 1][i], A[b - 1][i + (1 << (b - 1))]);
      }
    }
    for (unsigned int i = 2; i < N; ++i)
      L[i] = L[i - 1] + ((1 << L[i - 1]) == i / 2);
  }
  void update(const vector<T>& V) {
    A[0] = V;
    for (unsigned int b = 1; b < D; ++b) {
      for (unsigned int i = 0; i + (1 << b) <= N; ++i) {
        A[b][i] = op(A[b - 1][i], A[b - 1][i + (1 << (b - 1))]);
      }
    }
  }
  T get(unsigned int i, unsigned int j) const {
    return op(A[L[j - i]][i], A[L[j - i]][j + 1 - (1 << L[j - i])]);
  }

 private:
  Op op;
  unsigned int D, N;
  vector<vector<T>> A;
  vector<unsigned int> L;
};
template <typename F>
struct MinQOp {
  F operator()(F a, F b) const { return std::min(a, b); }
};
template <typename F>
struct MaxQOp {
  F operator()(F a, F b) const { return std::max(a, b); }
};
class FGardenerAlex {
 public:
  vector<int> A, I;
  ConstTree<int, MinQOp<int>> MQ{vector<int>{1}};
  bool canBeDone(int l, int r, int k) {
    if (l > r) return true;
    if (k < 20 && (r - l + 1) >= (1 << k)) return false;
    if (k == 0) return false;
    int m = MQ.get(l, r);
    int i = I[m];
    return canBeDone(l, i - 1, k - 1) && canBeDone(i + 1, r, k - 1);
  }
  void solve(istream& cin, ostream& cout) {
    int N;
    cin >> N;
    if (N == 1) {
      cout << 1 << ' ' << 0 << endl;
      return;
    }
    A.resize(N);
    cin >> A;
    int one = -1;
    for (int i = 0; i < N; ++i) {
      if (A[i] == 1) one = i;
      --A[i];
    }
    rotate(A.begin(), A.begin() + one, A.end());
    I.resize(N);
    for (int i = 0; i < N; ++i) I[A[i]] = i;
    MQ = ConstTree<int, MinQOp<int>>{A};
    vector<int> Z(N);
    int K = bsl(1, N / 2, [&](int k) {
      int w = bsh(1, N - 1, [&](int r) { return canBeDone(1, r, k); });
      Z[k] = w;
      return canBeDone(w + 1, N - 1, k);
    });
    cout << K + 1 << ' ' << (Z[K] + one + 1) % N << endl;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  FGardenerAlex solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}