#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n;
int arr[N];
vector<long long> sq;
int diff(long long x, int p) {
  long long a = 1ll * abs(x - sq[p]);
  if (p > 0) {
    if (abs(sq[p - 1] - x) < a) {
      a = abs(sq[p - 1] - x);
    }
  }
  return a;
}
inline bool cmp(const int &a, const int &b) {
  if (a == 0 && b != 0) {
    return 1;
  }
  int p1 = lower_bound(sq.begin(), sq.end(), a) - sq.begin();
  int p2 = lower_bound(sq.begin(), sq.end(), b) - sq.begin();
  return (diff(a, p1) < diff(b, p2));
}
int main() {
  cin >> n;
  for (int i = 0; i < 1e6; i++) {
    sq.push_back(1ll * i * i);
  }
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n, cmp);
  long long ans = 0;
  for (int i = 0; i < n / 2; i++) {
    ans +=
        (diff(arr[i], lower_bound(sq.begin(), sq.end(), arr[i]) - sq.begin()));
  }
  for (int i = n / 2; i < n; i++) {
    if (diff(arr[i], lower_bound(sq.begin(), sq.end(), arr[i]) - sq.begin()) ==
        0) {
      ans++;
    }
    ans += (arr[i] == 0);
  }
  cout << ans << endl;
  return 0;
}
