#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; ++i) cin >> arr[i];
  sort(arr, arr + n);
  long long x = 0, y = 0;
  if (n % 2 != 0) {
    for (long long i = n - 1; i >= 0; --i) {
      if (i >= n / 2)
        x += arr[i];
      else
        y += arr[i];
    }
  } else {
    for (long long i = n - 1; i >= 0; --i) {
      if (i > (n / 2) - 1)
        x += arr[i];
      else
        y += arr[i];
    }
  }
  cout << (x * x) + (y * y) << "\n";
  return 0;
}
