#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> piles(n);
  vector<pair<int, int>> cost(n);
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    piles[i] = tmp;
    int closest = int(sqrt(tmp) + 0.5f);
    cost[i] = pair<int, int>(abs(tmp - closest * closest), tmp);
  }
  sort(cost.begin(), cost.end());
  unsigned long long result = 0;
  for (int i = 0; i < n; i++) {
    int _cost = cost[i].first;
    int _number = cost[i].second;
    if (i < n / 2) {
      result += _cost;
    } else {
      if (_cost == 0) result++;
      if (_number == 0) result++;
    }
  }
  printf("%llu\n", result);
  return 0;
}
