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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskF {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[2 * n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt() - 1;
                a[i + n] = a[i];
            }

            SparseTable rmq = new SparseTable(a);
            IntervalTree treeDepth = new IntervalTree(2 * n);
            initDepths(rmq, treeDepth, n, a);

            int best = treeDepth.getMax();
            int bestShift = 0;
            for (int i = 0; i < n; i++) {
                int x = a[i];

                int l = 1;
                int r = n + 1;
                while (r - l > 1) {
                    int m = (l + r) / 2;
                    if (rmq.getMin(i, i + m - 1) == x) {
                        l = m;
                    } else {
                        r = m;
                    }
                }

                if (l == n) {
                    if (x != 0) {
                        throw new AssertionError();
                    }
                    treeDepth.add(i + n, i + n + 1, 1);
                    continue;
                }

                treeDepth.add(i + 1, i + l, -1);

                l = 1;
                r = n + 1;
                while (r - l > 1) {
                    int m = (l + r) / 2;
                    if (rmq.getMin(i + n - m + 1, i + n) == x) {
                        l = m;
                    } else {
                        r = m;
                    }
                }

                int j = i + n - l;

                int newParentDepth = treeDepth.getMax(j, j + 1);
                treeDepth.add(i + n, i + n + 1, newParentDepth + 1);

                treeDepth.add(j + 1, i + n, +1);

                int cur = treeDepth.getMax(i + 1, i + 1 + n);

                if (best > cur) {
                    best = cur;
                    bestShift = i + 1;
                }
            }
            out.println(best + " " + bestShift);
        }

        private void initDepths(SparseTable rmq, IntervalTree treeDepth, int n, int[] a) {
            int[] where = new int[n];
            for (int i = 0; i < n; i++) {
                where[a[i]] = i;
            }
            initDepthsRec(rmq, treeDepth, where, 0, n - 1, 1);
        }

        private void initDepthsRec(SparseTable rmq, IntervalTree treeDepth, int[] where, int l, int r, int cur) {
            if (l > r) {
                return;
            }
            int m = where[rmq.getMin(l, r)];
            treeDepth.add(m, m + 1, cur);
            initDepthsRec(rmq, treeDepth, where, l, m - 1, cur + 1);
            initDepthsRec(rmq, treeDepth, where, m + 1, r, cur + 1);
        }

        class IntervalTree {
            int n;
            int[] add;
            int[] max;

            IntervalTree(int n) {
                this.n = n;
                add = new int[4 * n];
                max = new int[4 * n];
            }

            int getMax() {
                return add[0] + max[0];
            }

            void add(int l, int r, int val) {
                addImpl(0, 0, n, l, r, val);
            }

            int getMax(int l, int r) {
                return getMaxImpl(0, 0, n, l, r);
            }

            void addImpl(int root, int rl, int rr, int l, int r, int val) {
                if (l < rl) {
                    l = rl;
                }
                if (r > rr) {
                    r = rr;
                }
                if (l >= r) {
                    return;
                }
                if (l == rl && r == rr) {
                    add[root] += val;
                    return;
                }
                int rm = (rl + rr) / 2;
                push(root);
                addImpl(2 * root + 1, rl, rm, l, r, val);
                addImpl(2 * root + 2, rm, rr, l, r, val);
                pull(root);
            }

            private int getMaxImpl(int root, int rl, int rr, int l, int r) {
                if (l < rl) {
                    l = rl;
                }
                if (r > rr) {
                    r = rr;
                }
                if (l >= r) {
                    return 0;
                }
                if (l == rl && r == rr) {
                    return add[root] + max[root];
                }
                int rm = (rl + rr) / 2;
                push(root);
                int lMax = getMaxImpl(2 * root + 1, rl, rm, l, r);
                int rMax = getMaxImpl(2 * root + 2, rm, rr, l, r);
                pull(root);
                return Math.max(lMax, rMax);
            }

            private void push(int root) {
                add[2 * root + 1] += add[root];
                add[2 * root + 2] += add[root];
                add[root] = 0;
            }

            private void pull(int root) {
                max[root] = Math.max(max[2 * root + 1] + add[2 * root + 1], max[2 * root + 2] + add[2 * root + 2]);
            }

        }

        private class SparseTable {
            int[][] t;
            int[] logs;
            final int infinity = (int) 1e9;

            SparseTable(int[] a) {
                int n = a.length;
                logs = new int[n + 1];
                for (int i = 1; i <= n; i++) {
                    if (i == 1) {
                        logs[i] = 0;
                    } else {
                        logs[i] = logs[i - 1];
                        while ((1 << logs[i]) <= i) {
                            ++logs[i];
                        }
                        --logs[i];
                    }
                }

                t = new int[logs[n] + 1][2 * n + 1];
                for (int log = 0; log < t.length; log++) {
                    for (int i = 0; i + (1 << log) <= n; i++) {
                        if (log == 0) {
                            t[log][i] = a[i];
                        } else {
                            t[log][i] = Math.min(t[log - 1][i], t[log - 1][i + (1 << (log - 1))]);
                        }
                    }
                }

            }

            int getMin(int l, int r) {
                if (l > r) {
                    return infinity;
                }
                int len = r - l + 1;
                int log = logs[len];
                return Math.min(t[log][l], t[log][r - (1 << log) + 1]);
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}