#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-6;
int main() {
  int n, x;
  cin >> n;
  priority_queue<int, vector<int>, greater<int> > q1, q2;
  for (int i = 0; i < n; i++) {
    cin >> x;
    int tmp = sqrt(x);
    if (tmp * tmp == x)
      q1.push(tmp ? 1 : 2);
    else
      q2.push(min((tmp + 1) * (tmp + 1) - x, x - tmp * tmp));
  }
  long long ans = 0;
  while (q1.size() > n / 2) ans += q1.top(), q1.pop();
  while (q2.size() > n / 2) ans += q2.top(), q2.pop();
  cout << ans << endl;
  return 0;
}
