#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s1 = 0, s2 = 0, a;
  cin >> n;
  vector<int> v;
  for (auto i = 1; i <= n; i++) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  for (auto i = 1; i <= n; i++) {
    if (i <= n / 2)
      s1 += v[i - 1];
    else
      s2 += v[i - 1];
  }
  cout << (s1 * s1) + (s2 * s2);
  return 0;
}
