#include <bits/stdc++.h>   #pragma GCC optimize( -O2 )   using namespace std;   const int LIM = 2e5 + 5, MOD = 1e9 + 7;   int t, n, m, k, x, y;   template <typename... T>   void read(T &...args) {     ((cin >> args), ...);   }   template <typename... T>   void print(T &&...args) {     ((cout << args <<    ), ...);   }   int main() {     int n;     read(n);     long long int arr[n];     for (int i = 0; i < n; i++) read(arr[i]);     sort(arr, arr + n);     long long int val = pow(arr[n - 1], 1.0 / (n - 1));     long long int a1 = 0, a2 = 0;     for (int i = 0; i < n; i++) {       a1 += abs(pow(val, i) - arr[i]);     }     val++;     for (int i = 0; i < n; i++) {       a2 += abs(pow(val, i) - arr[i]);     }     long long int curr = pow(val, n - 2), curr2 = pow(val, n - 1);     if (curr2 / curr == val)       cout << min(a1, a2) << endl;     else       cout << a1 << endl;     return 0;   }   