#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 2;
const long long mod = 1e9 + 7;
int main() {
  long long n;
  scanf("%lld", &n);
  long long a[n + 5];
  for (long long i = 0; i < n; i++) scanf("%lld", &a[i]);
  sort(a, a + n);
  long long ans = 0, mn = 1e18;
  if (n > 32) {
    for (long long i = 0; i < n; i++)
      if (a[i] > 1) ans += a[i] - 1;
    cout << ans;
  } else {
    for (long long i = 1; i < 1000000; i++) {
      if (pow(i, n - 1) < 1e18) {
        long long ans1 = 0;
        for (long long j = 0; j < n; j++) {
          ans1 += abs(pow(i, j) - a[j]);
        }
        mn = min(ans1, mn);
      }
    }
    cout << mn;
  }
}
