#include <bits/stdc++.h>
using namespace std;
using Int = int64_t;
int main() {
  Int n;
  cin >> n;
  vector<Int> p;
  while (n--) {
    Int temp;
    cin >> temp;
    p.emplace_back(temp);
  }
  Int x = 0;
  Int y = 0;
  sort(p.begin(), p.end());
  Int i = 0;
  Int j = p.size() - 1;
  while (i < j) {
    x += p[j--];
    y += p[i++];
  }
  if (i == j) x += p[i];
  cout << x * x + y * y << endl;
  return 0;
}
