#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int num;
  for (int i = 0; i < n; ++i) {
    cin >> num;
    v.push_back(num);
  }
  sort(v.begin(), v.end());
  long long x1 = 0, y1 = 0;
  int sz = n / 2;
  for (int i = 0; i < sz; ++i) {
    y1 += v[i];
  }
  for (int i = n - 1; i >= sz; --i) {
    x1 += v[i];
  }
  long long ans = x1 * x1 + y1 * y1;
  cout << ans << endl;
  return 0;
}
