#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  long long i, j, w = 0, h = 0;
  for (i = 0, j = n - 1; i <= j; i++, j--) {
    if (i != j) {
      w += v[i];
      h += v[j];
    } else
      h += v[j];
  }
  cout << (w * w) + (h * h) << endl;
  return 0;
}
