#include <bits/stdc++.h>
using namespace std;
namespace aux {
template <std::size_t...>
struct seq {};
template <std::size_t N, std::size_t... Is>
struct gen_seq : gen_seq<N - 1, N - 1, Is...> {};
template <std::size_t... Is>
struct gen_seq<0, Is...> : seq<Is...> {};
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void print_tuple(std::basic_ostream<Ch, Tr>& os, Tuple const& t, seq<Is...>) {
  using swallow = int[];
  (void)swallow{0,
                (void(os << (Is == 0 ? "" : ", ") << std::get<Is>(t)), 0)...};
}
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) {
    v.emplace_back(x);
  }
  return v;
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
}  // namespace aux
template <class Ch, class Tr, class... Args>
auto operator<<(std::basic_ostream<Ch, Tr>& os, std::tuple<Args...> const& t)
    -> std::basic_ostream<Ch, Tr>& {
  os << "(";
  aux::print_tuple(os, t, aux::gen_seq<sizeof...(Args)>());
  return os << ")";
}
template <class S, class T>
std::ostream& operator<<(std::ostream& o, const std::pair<S, T>& p) {
  return o << "(" << p.first << ", " << p.second << ")";
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << "[";
  if (vec.size() != 0) {
    std::copy(vec.begin(), vec.end() - 1, std::ostream_iterator<T>(os, ", "));
    os << vec.back();
  }
  return os << "]";
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& s) {
  os << "{";
  if (s.size() != 0) {
    std::copy(s.begin(), --s.end(), std::ostream_iterator<T>(os, ", "));
    os << *(--s.end());
  }
  return os << "}";
}
template <class It, char Delim = ' '>
void print_range(It a, It b) {
  for (auto it = a; it != b; it++) {
    cout << *it << Delim;
  }
  cout << "\n";
}
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
struct Test {
  Test(int test_number) : test_number(test_number) {}
  int test_number;
  void solve();
  void run() {
    auto start = chrono::steady_clock::now();
    solve();
    auto end = chrono::steady_clock::now();
    auto diff = end - start;
    cerr << "Running time: "
         << chrono::duration_cast<chrono::milliseconds>(diff).count() << "ms\n";
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.setf(ios::fixed);
  cout.precision(9);
  cerr.setf(ios::fixed);
  cerr.precision(3);
  int num_tests = 1;
  for (int i = 1; i <= num_tests; i++) {
    Test cur(i);
    cur.run();
  }
}
const int MAX_N = 1000005;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int n, p[MAX_N];
long long adds[MAX_N];
inline void update(int a, int b, int c) {
  if (a > b) {
    return;
  }
  adds[a] += c;
  adds[b + 1] -= c;
}
void Test::solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    --p[i];
    if (i <= p[i]) {
      update(1, p[i] - i, -1);
      update(p[i] - i + 1, n - i - 1, 1);
      update(n - i, n - i,
             (p[i] - i) - (n - i - 1 - (p[i] - i + 1) + 1) - (p[i] - i) + p[i]);
      update(n - i + 1, n - 1, -1);
    } else {
      update(1, n - i - 1, 1);
      update(n - i, n - i, -(n - i - 1) - (i - p[i]) + p[i]);
      update(n - i + 1, n - i + 1 + p[i] - 1, -1);
      update(n - i + 1 + p[i], n - 1, 1);
    }
  }
  long long cur = 0;
  long long sum = 0;
  long long mn = 0;
  int idx = -1;
  for (int i = 0; i < n; i++) {
    sum += adds[i];
    cur += sum;
    if (idx < 0 || (cur < mn)) {
      idx = i;
      mn = cur;
    }
  }
  for (int i = 0; i < n; i++) {
    mn += abs(p[i] - i);
  }
  cout << mn << " " << idx << endl;
}

### Prompt

In cpp, your task is to solve the following problem:

Some time ago Mister B detected a strange signal from the space, which he started to study.

After some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investigation Mister B need some basis, that's why he decided to choose cyclic shift of this permutation which has the minimum possible deviation.

Let's define the deviation of a permutation p as <image>.

Find a cyclic shift of permutation p with minimum possible deviation. If there are multiple solutions, print any of them.

Let's denote id k (0 ≤ k < n) of a cyclic shift of permutation p as the number of right shifts needed to reach this shift, for example:

  * k = 0: shift p1, p2, ... pn, 
  * k = 1: shift pn, p1, ... pn - 1, 
  * ..., 
  * k = n - 1: shift p2, p3, ... pn, p1. 

Input

First line contains single integer n (2 ≤ n ≤ 106) — the length of the permutation.

The second line contains n space-separated integers p1, p2, ..., pn (1 ≤ pi ≤ n) — the elements of the permutation. It is guaranteed that all elements are distinct.

Output

Print two integers: the minimum deviation of cyclic shifts of permutation p and the id of such shift. If there are multiple solutions, print any of them.

Examples

Input

3
1 2 3


Output

0 0


Input

3
2 3 1


Output

0 1


Input

3
3 2 1


Output

2 1

Note

In the first sample test the given permutation p is the identity permutation, that's why its deviation equals to 0, the shift id equals to 0 as well.

In the second sample test the deviation of p equals to 4, the deviation of the 1-st cyclic shift (1, 2, 3) equals to 0, the deviation of the 2-nd cyclic shift (3, 1, 2) equals to 4, the optimal is the 1-st cyclic shift.

In the third sample test the deviation of p equals to 4, the deviation of the 1-st cyclic shift (1, 3, 2) equals to 2, the deviation of the 2-nd cyclic shift (2, 1, 3) also equals to 2, so the optimal are both 1-st and 2-nd cyclic shifts.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
namespace aux {
template <std::size_t...>
struct seq {};
template <std::size_t N, std::size_t... Is>
struct gen_seq : gen_seq<N - 1, N - 1, Is...> {};
template <std::size_t... Is>
struct gen_seq<0, Is...> : seq<Is...> {};
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void print_tuple(std::basic_ostream<Ch, Tr>& os, Tuple const& t, seq<Is...>) {
  using swallow = int[];
  (void)swallow{0,
                (void(os << (Is == 0 ? "" : ", ") << std::get<Is>(t)), 0)...};
}
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) {
    v.emplace_back(x);
  }
  return v;
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
}  // namespace aux
template <class Ch, class Tr, class... Args>
auto operator<<(std::basic_ostream<Ch, Tr>& os, std::tuple<Args...> const& t)
    -> std::basic_ostream<Ch, Tr>& {
  os << "(";
  aux::print_tuple(os, t, aux::gen_seq<sizeof...(Args)>());
  return os << ")";
}
template <class S, class T>
std::ostream& operator<<(std::ostream& o, const std::pair<S, T>& p) {
  return o << "(" << p.first << ", " << p.second << ")";
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << "[";
  if (vec.size() != 0) {
    std::copy(vec.begin(), vec.end() - 1, std::ostream_iterator<T>(os, ", "));
    os << vec.back();
  }
  return os << "]";
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& s) {
  os << "{";
  if (s.size() != 0) {
    std::copy(s.begin(), --s.end(), std::ostream_iterator<T>(os, ", "));
    os << *(--s.end());
  }
  return os << "}";
}
template <class It, char Delim = ' '>
void print_range(It a, It b) {
  for (auto it = a; it != b; it++) {
    cout << *it << Delim;
  }
  cout << "\n";
}
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
struct Test {
  Test(int test_number) : test_number(test_number) {}
  int test_number;
  void solve();
  void run() {
    auto start = chrono::steady_clock::now();
    solve();
    auto end = chrono::steady_clock::now();
    auto diff = end - start;
    cerr << "Running time: "
         << chrono::duration_cast<chrono::milliseconds>(diff).count() << "ms\n";
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.setf(ios::fixed);
  cout.precision(9);
  cerr.setf(ios::fixed);
  cerr.precision(3);
  int num_tests = 1;
  for (int i = 1; i <= num_tests; i++) {
    Test cur(i);
    cur.run();
  }
}
const int MAX_N = 1000005;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int n, p[MAX_N];
long long adds[MAX_N];
inline void update(int a, int b, int c) {
  if (a > b) {
    return;
  }
  adds[a] += c;
  adds[b + 1] -= c;
}
void Test::solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    --p[i];
    if (i <= p[i]) {
      update(1, p[i] - i, -1);
      update(p[i] - i + 1, n - i - 1, 1);
      update(n - i, n - i,
             (p[i] - i) - (n - i - 1 - (p[i] - i + 1) + 1) - (p[i] - i) + p[i]);
      update(n - i + 1, n - 1, -1);
    } else {
      update(1, n - i - 1, 1);
      update(n - i, n - i, -(n - i - 1) - (i - p[i]) + p[i]);
      update(n - i + 1, n - i + 1 + p[i] - 1, -1);
      update(n - i + 1 + p[i], n - 1, 1);
    }
  }
  long long cur = 0;
  long long sum = 0;
  long long mn = 0;
  int idx = -1;
  for (int i = 0; i < n; i++) {
    sum += adds[i];
    cur += sum;
    if (idx < 0 || (cur < mn)) {
      idx = i;
      mn = cur;
    }
  }
  for (int i = 0; i < n; i++) {
    mn += abs(p[i] - i);
  }
  cout << mn << " " << idx << endl;
}

```