#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1);
  long long int re[n];
  for (int i = 1; i <= n; i++) {
    re[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    long long int p = sqrt(arr[i]);
    if (p * p == arr[i]) {
      re[i] = 0;
    } else {
      re[i] = min(arr[i] - p * p, (p + 1) * (p + 1) - arr[i]);
    }
  }
  long long int ans = 0;
  sort(re + 1, re + n + 1);
  for (long long int i = 1; i <= n / 2; i++) {
    ans += re[i];
  }
  for (int i = n / 2 + 1; i <= n; i++) {
    if (re[i] == 0) {
      if (arr[i] == 0) {
        ans += 2;
      } else {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}
