#include <bits/stdc++.h>
using namespace std;
template <typename T>
T modpower(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
const long long mod = 1e9 + 7;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool issub(string x, string y) {
  int n = x.length();
  int m = y.length();
  for (int i = 1; i <= n; i++) {
    if (x[n - i] != y[m - i]) return 0;
  }
  return 1;
}
int floorSqrt(int x) {
  if (x == 0 || x == 1) return x;
  int start = 1, end = x, ans;
  while (start <= end) {
    int mid = (start + end) / 2;
    if (1ll * mid * mid == x) return mid;
    if (1ll * mid * mid < x) {
      start = mid + 1;
      ans = mid;
    } else
      end = mid - 1;
  }
  return ans;
}
int mo(int x) {
  int rr = floorSqrt(x);
  return (int)min(abs((1ll * rr * rr) - x),
                  abs((1ll * (rr + 1) * (rr + 1)) - x));
}
int E() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back(make_pair(mo(t), t));
  }
  sort(v.begin(), v.end());
  long long result = 0;
  int i = 0;
  for (; i < (n / 2); i++) {
    result += v[i].first;
  }
  for (; i < n; i++) {
    if (v[i].first != 0) break;
    if (v[i].second != 0) {
      result++;
    } else {
      result += 2;
    }
  }
  cout << result << "\n";
  return 0;
}
int main() {
  E();
  return 0;
}
