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 INF = 1e9 + 5;
struct segment_change {
  int to_add;
  segment_change(int _to_add = 0) : to_add(_to_add) {}
  void reset() { to_add = 0; }
  bool has_change() const { return to_add != 0; }
  segment_change combine(const segment_change &other) const {
    return segment_change(to_add + other.to_add);
  }
};
struct segment {
  int maximum;
  segment(int _maximum = -INF) : maximum(_maximum) {}
  void apply(int, const segment_change &change) { maximum += change.to_add; }
  void join(const segment &other) { maximum = max(maximum, other.maximum); }
  void join(const segment &a, const segment &b) {
    *this = a;
    join(b);
  }
};
struct add_max_seg_tree {
  int tree_n = 0;
  vector<segment> tree;
  vector<segment_change> changes;
  add_max_seg_tree(int n = 0) {
    if (n > 0) init(n);
  }
  void init(int n) {
    tree_n = 1;
    while (tree_n < n) tree_n *= 2;
    tree.assign(2 * tree_n, segment());
    changes.assign(tree_n, segment_change());
  }
  void build(const vector<segment> &initial) {
    int n = initial.size();
    assert(n <= tree_n);
    for (int i = 0; i < n; i++) tree[tree_n + i] = initial[i];
    for (int position = tree_n - 1; position > 0; position--)
      tree[position].join(tree[2 * position], tree[2 * position + 1]);
  }
  void push_down(int position, int length) {
    if (!changes[position].has_change()) return;
    if (2 * position < tree_n) {
      changes[2 * position] = changes[2 * position].combine(changes[position]);
      changes[2 * position + 1] =
          changes[2 * position + 1].combine(changes[position]);
    }
    tree[2 * position].apply(length / 2, changes[position]);
    tree[2 * position + 1].apply(length / 2, changes[position]);
    changes[position].reset();
  }
  void push_all(int a, int b) {
    assert(0 <= a && a < b && b <= tree_n);
    a += tree_n;
    b += tree_n - 1;
    for (int up = 31 - __builtin_clz(tree_n); up > 0; up--) {
      int x = a >> up, y = b >> up;
      push_down(x, 1 << up);
      if (x != y) push_down(y, 1 << up);
    }
  }
  void join_and_apply(int position, int length) {
    tree[position].join(tree[2 * position], tree[2 * position + 1]);
    tree[position].apply(length, changes[position]);
  }
  void join_all(int a, int b) {
    assert(0 <= a && a < b && b <= tree_n);
    a += tree_n;
    b += tree_n - 1;
    int length = 1;
    while (a > 1) {
      a /= 2;
      b /= 2;
      length *= 2;
      join_and_apply(a, length);
      if (a != b) join_and_apply(b, length);
    }
  }
  pair<int, int> right_half[32];
  template <typename T_range_op>
  void process_range(int a, int b, bool needs_join, T_range_op &&range_op) {
    if (a == b) return;
    push_all(a, b);
    int original_a = a, original_b = b;
    int length = 1, r_size = 0;
    for (a += tree_n, b += tree_n; a < b; a /= 2, b /= 2, length *= 2) {
      if (a & 1) range_op(a++, length);
      if (b & 1) right_half[r_size++] = {--b, length};
    }
    for (int i = r_size - 1; i >= 0; i--)
      range_op(right_half[i].first, right_half[i].second);
    if (needs_join) join_all(original_a, original_b);
  }
  segment query(int a, int b) {
    assert(0 <= a && a <= b && b <= tree_n);
    segment answer;
    process_range(a, b, false,
                  [&](int position, int) { answer.join(tree[position]); });
    return answer;
  }
  void update(int a, int b, const segment_change &change) {
    assert(0 <= a && a <= b && b <= tree_n);
    process_range(a, b, true, [&](int position, int length) {
      tree[position].apply(length, change);
      if (position < tree_n)
        changes[position] = changes[position].combine(change);
    });
  }
  void set_value(int index, int value) {
    assert(0 <= index && index < tree_n);
    int current = query(index, index + 1).maximum;
    update(index, index + 1, segment_change(value - current));
  }
};
int N;
vector<int> parent;
vector<vector<int>> children;
vector<int> tour_start, tour_end;
int tour;
void dfs(int node) {
  tour_start[node] = tour++;
  for (int child : children[node]) dfs(child);
  tour_end[node] = tour;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) {
    if (vi != v.begin()) os << ", ";
    os << *vi;
  }
  os << "}";
  return os;
}
template <>
ostream &operator<<(ostream &os, const vector<string> &v) {
  os << "{";
  for (vector<string>::const_iterator vi = v.begin(); vi != v.end(); ++vi) {
    if (vi != v.begin()) os << ", ";
    os << "\"" << *vi << "\"";
  }
  os << "}";
  return os;
}
vector<int> solve(vector<int> perm) {
  assert((int)perm.size() == N);
  assert(perm.front() == 1);
  for (int &p : perm) p--;
  parent.assign(N, -1);
  vector<pair<int, int>> events;
  vector<int> stack = {-1};
  for (int x : perm) {
    int erased = -1;
    while (stack.back() > x) {
      erased = stack.back();
      stack.pop_back();
    }
    events.emplace_back(x, stack.back());
    events.emplace_back(erased, x);
    parent[x] = stack.back();
    if (erased >= 0) parent[erased] = x;
    stack.push_back(x);
  }
  children.assign(N, {});
  tour_start.resize(N);
  tour_end.resize(N);
  for (int i = 0; i < N; i++)
    if (parent[i] >= 0) children[parent[i]].push_back(i);
  tour = 0;
  dfs(0);
  vector<int> answers(N, INF);
  add_max_seg_tree tree(N);
  for (int i = 0; i < N; i++) {
    int a = events[2 * i].first;
    int b = events[2 * i].second;
    assert(a >= 0);
    tree.set_value(
        tour_start[a],
        b < 0 ? 1 : tree.query(tour_start[b], tour_start[b] + 1).maximum + 1);
    a = events[2 * i + 1].first;
    b = events[2 * i + 1].second;
    if (a >= 0) {
      tree.update(tour_start[a], tour_end[a], segment_change(+1));
    }
    answers[i] = tree.query(0, N).maximum;
  }
  return answers;
}
vector<int> A;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N;
  A.resize(N);
  for (int &a : A) cin >> a;
  int one = find(A.begin(), A.end(), 1) - A.begin();
  vector<int> start_one, end_one;
  for (int i = one; (int)start_one.size() < N; i = (i + 1) % N)
    start_one.push_back(A[i]);
  for (int i = one; (int)end_one.size() < N; i = (i + N - 1) % N)
    end_one.push_back(A[i]);
  vector<int> left = solve(end_one), right = solve(start_one);
  int best_left = 0, best = INF;
  for (int i = 0; i < N; i++) {
    if (max(left[i], right[N - 1 - i]) < best) {
      best = max(left[i], right[N - 1 - i]);
      best_left = i;
    }
  }
  cout << best << ' ' << (one - best_left + N) % N << '\n';
}