#include <bits/stdc++.h>
using namespace std;
long long ar[3000000];
set<long long> st;
vector<long long> v;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, cnt(0);
  cin >> n;
  for (long long i = 0; i <= 31633; i++) {
    st.insert(i * i);
  }
  for (long long i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] == 0)
      cnt++;
    else {
      long long r = sqrtl(ar[i]);
      if (r * r == ar[i])
        ;
      else {
        long long h1 = ar[i] - r * r;
        r++;
        long long h2 = r * r - ar[i];
        v.push_back(min(h1, h2));
      }
    }
  }
  sort(v.begin(), v.end());
  for (long long i = 1; i < v.size(); i++) {
    v[i] += v[i - 1];
  }
  if (v.size() == n / 2)
    cout << 0;
  else if (v.size() > n / 2)
    cout << v[v.size() - n / 2 - 1];
  else {
    long long h = n / 2 - v.size();
    long long y = n - v.size();
    long long g = y - cnt;
    if (g >= h)
      cout << h;
    else {
      cout << g + (h - g) * 2;
    }
  }
}
