#include <bits/stdc++.h>
using namespace std;
class TaskE {
 public:
  long long int dist(long long n) {
    double guess = sqrt(n);
    long long r = floor(guess);
    long long int n1 = abs(r * r - n);
    r = ceil(guess);
    return min(abs(r * r - n), n1);
  }
  void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vector<long long int> sq;
    vector<pair<long long int, long long int>> nsq;
    for (int i = 0; i < n; i++) {
      int x;
      in >> x;
      long long int diff = dist(x);
      if (diff == 0)
        sq.push_back(x);
      else
        nsq.push_back({diff, x});
    }
    if (sq.size() >= n / 2) {
      long long int res = 0;
      sort(sq.rbegin(), sq.rend());
      for (int i = 0; i < sq.size() - n / 2; i++) {
        if (sq[i] == 0)
          res += 2;
        else
          res++;
      }
      out << res;
    } else {
      sort(nsq.begin(), nsq.end());
      long long int res = 0;
      for (int i = 0; i < n / 2 - sq.size(); i++) {
        res += nsq[i].first;
      }
      out << res;
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  TaskE solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
