#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  deque<int> v;
  for (int i = 0; i < (int)(n); i++) {
    int x;
    cin >> x;
    v.push_back(x);
  };
  sort((v).begin(), (v).end());
  int64_t w = 0, h = 0;
  int m = 1;
  while (!v.empty()) {
    if (m) {
      w += v.back();
      v.pop_back();
    } else {
      h += v.front();
      v.pop_front();
    }
    m = (m + 1) % 2;
  }
  cout << w * w + h * h << '\n';
}
