#include <bits/stdc++.h>
using namespace std;
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
class data {
 public:
  int num;
  int cost;
  data() {}
  data(int a, int b) {
    num = a;
    cost = b;
  }
  bool operator<(const data& b) const {
    if (cost == b.cost) {
      return num < b.num;
    }
    return cost < b.cost;
  }
};
data ara[200010];
vector<int> yo;
void pre() {
  for (int i = 0; i <= 40010; i++) {
    yo.push_back(i * i);
  }
}
int func(int num) {
  int a = lower_bound(yo.begin(), yo.end(), num) - yo.begin();
  if (yo[a] == num) {
    return 0;
  }
  int b = a;
  a--;
  return min(num - yo[a], yo[b] - num);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  pre();
  int n;
  cin >> n;
  for (int i = 0; i <= n - 1; i++) {
    int num;
    cin >> num;
    ara[i] = data(num, func(num));
  }
  sort(ara, ara + n);
  long long ans = 0;
  int lim = n / 2;
  for (int i = 0; i <= lim - 1; i++) {
    ans += ara[i].cost;
  }
  for (int i = lim; i <= n - 1; i++) {
    if (ara[i].num == 0) {
      ans += 2;
    } else if (func(ara[i].num) == 0) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
