#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> d(n);
  long long t = 0;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    t += d[i];
  }
  sort(d.begin(), d.end());
  long long curt = 0;
  for (int i = 0; i < n / 2; i++) curt += d[i];
  cout << curt * curt + (t - curt) * (t - curt) << endl;
  return 0;
}
