#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    int y = sqrt(x + 0.5);
    int z1 = abs(x - y * y);
    int z2 = abs(x - (y + 1) * (y + 1));
    if (z1 < z2)
      q.push(make_pair(z1, x));
    else
      q.push(make_pair(z2, x));
  }
  long long ans = 0;
  for (int i = 0; i < (n >> 1); i++) {
    ans += q.top().first;
    q.pop();
  }
  while (!q.empty() && q.top().first == 0) {
    ans++;
    if (q.top().second == 0) ans++;
    q.pop();
  }
  printf("%I64d\n", ans);
  return 0;
}
