#include <bits/stdc++.h>
using namespace std;
long a[200100 + 10];
int main() {
  int n;
  cin >> n;
  vector<long> toAdd;
  int countRoots = 0;
  int countZero = 0;
  int p;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int root = sqrt(a[i]);
    if (root * root == a[i]) {
      countRoots++;
    } else {
      long long sq = (root + 1) * (root + 1);
      long long sq2 = (root) * (root);
      toAdd.push_back((sq - a[i]) < (a[i] - sq2) ? (sq - a[i]) : (a[i] - sq2));
    }
    if (a[i] == 0) countZero++;
  }
  if (countRoots < n / 2) {
    sort(toAdd.begin(), toAdd.end());
    long long sum = 0;
    for (int i = 0; i < n / 2 - countRoots; i++) {
      sum += toAdd[i];
    }
    cout << sum << "\n";
  } else if (countRoots > n / 2) {
    if (countZero <= n / 2) {
      cout << (countRoots - n / 2) << "\n";
    } else {
      cout << (countRoots - n / 2 + countZero - n / 2) << "\n";
    }
  } else {
    cout << "0\n";
  }
  return 0;
}
