#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return power((x * x) % (long long int)1000000007, y / 2);
  else
    return (x * power((x * x) % (long long int)1000000007, (y - 1) / 2)) %
           (long long int)1000000007;
}
long long int modInverse(long long int n) {
  return power(n, (long long int)1000000007 - 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) cin >> v[i];
    long long int x = 0, y = 0;
    sort(v.begin(), v.end());
    for (long long int i = 0; i < n / 2; i++) {
      x += v[n - i - 1];
      y += v[i];
    }
    if (n % 2 == 1) x += v[n / 2];
    cout << (x * x) + (y * y) << endl;
  }
  return 0;
}
