#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  long long sum1 = 0;
  long long sum2 = 0;
  for (int i = 0; i < n; i++) {
    if (i < n / 2)
      sum1 += v[i];
    else
      sum2 += v[i];
  }
  cout << (sum1 * sum1) + (sum2 * sum2);
}
