#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> v;
long long check(long long mid) {
  long long sum = 0, x = mid;
  sum += abs(v[0] - 1);
  for (long long i = 1; i < n; ++i) {
    sum += abs(v[i] - mid);
    if (i != n - 1) {
      mid *= x;
    }
  }
  return sum;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  long long l = 0, r = pow(1e10, (long double)1 / (n - 1));
  while (r - l > 2) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    if (check(m1) < check(m2)) {
      r = m2;
    } else {
      l = m1;
    }
  }
  long long ans = 1e18;
  for (long long i = l; i <= r; ++i) {
    ans = min(ans, check(i));
  }
  cout << ans;
  return 0;
}
