#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
ll check(ll n)
{
    ll tmp = sqrt(n);
    if(tmp * tmp == n) return 1;
    return 0;
}
int main()
{
    Faster;
    int n; cin >> n;
    ll ans = 0;
    vector<int> vt;
    while(n--)
    {
        ll x; cin >> x;
        if(check(x))
        {
            vt.push_back(x);
            ans += x;
        }
    }
    if(vt.size() != 0)
    {
        for(auto &x : vt) cout << x << " ";
        cout << el << ans;
    }
    return 0;
}

