#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, zero = 0, square = 0;
  cin >> n;
  vector<long long> v(n);
  ;
  std::vector<long long> dif;
  ;
  for (long long i = 0; i <= n - 1; i++) {
    cin >> v[i];
    if (!v[i]) zero++;
    long long x = sqrt(v[i]);
    long long y = v[i] - x * x;
    ++x;
    y = min(y, x * x - v[i]);
    if (y == 0)
      ++square;
    else
      dif.push_back(y);
  }
  if (square == n / 2) {
    cout << 0 << endl;
  } else if (square < n / 2) {
    sort(dif.begin(), dif.end());
    long long sum = 0;
    for (long long i = 0; i <= n / 2 - square - 1; i++) {
      sum += dif[i];
    }
    cout << sum << endl;
  } else {
    long long sum;
    sum = square - n / 2;
    long long non_zero = square - zero;
    if (non_zero < sum) {
      sum += (sum - non_zero);
    }
    cout << sum << endl;
  }
  return 0;
}
