#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, c = 0, d = 0, j;
  cin >> a;
  int x = a / 2;
  vector<int> s;
  while (a--) {
    int b;
    cin >> b;
    s.push_back(b);
  }
  sort(s.begin(), s.end());
  for (int i = 0; i < x; i++) {
    d += s[i];
  }
  for (int i = s.size() - 1; i >= x; i--) {
    c += s[i];
  }
  long long h = (pow(c, 2) + pow(d, 2));
  cout << h << "\n";
  return 0;
}
