#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long long s = 0, S = 0;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i], S += v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n / 2; ++i) {
    s += v[i];
  }
  cout << s * s + (S - s) * (S - s);
}
