#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 7;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort(v.rbegin(), v.rend());
  pair<long long, long long> pos = {0, 0};
  long long ch = 1;
  long long i = 0, j = n - 1;
  while (i <= j) {
    if (ch == 1) {
      pos = {pos.first + v[i], pos.second};
      i++;
    } else {
      pos = {pos.first, pos.second + v[j]};
      j--;
    }
    ch *= -1;
  }
  cout << (long long)(pow((pos.first), 2) + pow((pos.second), 2));
  return 0;
}
