//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const ll  LINF = (ll)1 << 60;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> cnt(500,0);
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
    cnt[a[i]+200]++;
  }
  ll ans=0;
  rep(i,n){
    cnt[a[i]+200]--;
    REP(j,-200,201){
      ans+=pow(abs((j)-a[i]),2)*cnt[j+200];
    }
  }
  cout<<ans<<'\n';
  return(0);
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define fi first 
#define se second 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);
#define mem(a,v) memset(a,v,sizeof(a))
const ll INF=1e18;
const int mod=1e9+7;
const int iinf=1e9+10;
const int xd[4]={1,0,-1,0},yd[4]={0,1,0,-1},mxN=2e5+2;
map<string,int> mp,mp1;
string s[mxN];
int main(){
    faster
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
        string g="";
        if(s[i][0]=='!'){
            for(int j=1;j<sz(s[i]);j++)
                g+=s[i][j];
            mp1[g]++;
        }
        else {
            g=s[i];
            mp[g]++;
        }
    }
    for(auto a:mp){
        //cout<<"a.fi="<<a.fi<<"\n";
        if(mp1.find(a.fi)!=mp1.end()){
            cout<<a.fi;exit(0);
        }
    }
    cout<<"satisfiable";
}