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 JAVA):

Solution:
import java.util.*;
import java.math.*;
import java.io.*;

public class f {
	class Node {
		int l, r, d, v;
		Node left, right;
		public Node(int ll, int rr) {
			l = ll;  r = rr;
			if(l != r) {
				int m = (l + r) / 2;
				left = new Node(l, m);
				right = new Node(m + 1, r);
			}
		}
		void prop() {
			left.d += d;  right.d += d;
			d = 0;
		}
		void update() {
			v = Math.max(left.v + left.d, right.v + right.d);
		}
		void inc(int a, int b, int x) {
			if(b < l || r < a) return;
			if(a <= l && r <= b) {
				d += x;
				return;
			}
			prop();
			left.inc(a, b, x);
			right.inc(a, b, x);
			update();
		}
		int max(int a, int b) {
			if(b < l || r < a) return -oo;
			if(a <= l && r <= b) return v + d;
			prop();
			int maxl = left.max(a, b);
			int maxr = right.max(a, b);
			update();
			return Math.max(maxl, maxr);
		}
		void print() {
			if(l == r) {
				System.out.print(v + d + " ");
				return;
			}
			prop();
			left.print();
			right.print();
			update();
		}
	}
	final int oo = (int) 1e9;
	class Graph {
		int n;
		List<Integer>[] adj;
		public Graph(int nn) {
			adj = new ArrayList[n = nn];
			for(int i = 0 ; i < n ; adj[i++] = new ArrayList<>());
		}
		void add(int u, int v) {
			adj[u].add(v);
		}
		int t = 0;
		int[] pre, post;
		void prepost() {
			pre = new int[n];
			post = new int[n];
			dfs(0);
		}
		void dfs(int u) {
			pre[u] = post[u] = t++;
			for(int v : adj[u]) {
				dfs(v);
				post[u] = Math.max(post[u], post[v]);
			}
		}
	}
	int buildGraph(int l, int r) {
		if(r < l) return -1;
		int min = -max.max(l, r);
		int id = rev[min];
		int minL = buildGraph(l, id - 1);
		int minR = buildGraph(id + 1, r);
		if(minL != -1) g.add(min, minL);
		if(minR != -1) g.add(min, minR);
		return min;
	}
	int[] p, rev;
	Graph g;
	Node max;
	List<Integer> perm;
	public f() {
		FS scan = new FS();
		int n = scan.nextInt();
		p = new int[n];
		int id0 = -1;
		for(int i = 0 ; i < n ; i++) {
			p[i] = scan.nextInt() - 1;
			if(p[i] == 0) id0 = i;
		}
		int[] tp = new int[n];
		for(int i = 0 ; i < n ; i++) {
			tp[i] = p[id0++];
			if(id0 == n) id0 -= n;
		}
		p = tp;
		max = new Node(0, n - 1);
		for(int i = 0 ; i < n ; i++)
			max.inc(i, i, -p[i]);
		g = new Graph(n);
		rev = new int[n];
		for(int i = 0 ; i < n ; i++)
			rev[p[i]] = i;
		buildGraph(0, n - 1);
		g.prepost();
		int[] maxRtoL = new int[n];
		Node st = new Node(0, n - 1);
		for(int i = 0 ; i < n ; i++)
			st.inc(g.pre[i], g.post[i], +1);
		for(int i = n - 1 ; i >= 0 ; i--) {
			maxRtoL[i] = st.max(0, n - 1);
			st.inc(g.pre[p[i]], g.pre[p[i]], -oo);
			st.inc(g.pre[p[i]], g.post[p[i]], -1);
		}
		for(int i = 0 ; i < n - 1 ; i++)
			p[i] = p[i + 1];
		p[n - 1] = 0;
		max = new Node(0, n - 1);
		for(int i = 0 ; i < n ; i++)
			max.inc(i, i, -p[i]);
		g = new Graph(n);
		for(int i = 0 ; i < n ; i++)
			rev[p[i]] = i;
		buildGraph(0, n - 1);
		g.prepost();
		int[] maxLtoR = new int[n];
		st = new Node(0, n - 1);
		for(int i = 0 ; i < n ; i++)
			st.inc(g.pre[i], g.post[i], +1);
		// st.print();
		// System.out.println();
		// System.out.println("pre:  " + Arrays.toString(g.pre));
		// System.out.println("post: " + Arrays.toString(g.post));
		for(int i = 0 ; i < n ; i++) {
			maxLtoR[i] = st.max(0, n - 1);
			st.inc(g.pre[p[i]], g.pre[p[i]], -oo);
			st.inc(g.pre[p[i]], g.post[p[i]], -1);
		}
		int min = oo, ind = -1;
		for(int i = 0 ; i < n ; i++) {
			int maxboth = Math.max(maxLtoR[i], maxRtoL[i]);
			if(maxboth < min) {
				min = maxboth;
				ind = n - i - 1;
			}
		}
		int shift = id0 - ind;
		if(shift < 0) shift += n;
		System.out.println(min + " " + shift);
//		System.out.println(ind);
//		System.out.println(id0);
//		System.out.println(Arrays.toString(maxRtoL));
//		System.out.println(Arrays.toString(maxLtoR));
	}
	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		public String next() {
			while(!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch(Exception e) { e.printStackTrace(); }
			}
			return st.nextToken();
		}
		public int nextInt() { return Integer.parseInt(next()); }
	}
	public static void main(String[] args) throws Exception { new f(); }
}
/*

6
4 2 5 1 6 3

https://codeforces.com/problemset/problem/1220/F

*/