#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long int> sq, nsq;
  int n;
  cin >> n;
  long long int ans = 0;
  for (int j = 0; j < n; j++) {
    long long int x;
    cin >> x;
    long long int t = sqrt(x);
    if (t * t == x) {
      if (x != 0)
        sq.push_back(1);
      else
        sq.push_back(2);
    } else {
      long long int left = x - t * t;
      long long int right = (t + 1) * (t + 1) - x;
      nsq.push_back((left > right) ? right : left);
    }
  }
  sort(sq.begin(), sq.end());
  sort(nsq.begin(), nsq.end());
  long long int req = n / 2;
  if (nsq.size() > req) {
    int t = nsq.size(), j = 0;
    while (t > req) ans += nsq[j++], t--;
  } else {
    int t = sq.size(), j = 0;
    while (t > req) ans += sq[j++], t--;
  }
  cout << ans << endl;
  return 0;
}
