#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int l = 0, r = n - 1;
  long long low = 0, high = 0;
  int i = 1;
  while (l <= r) {
    if (i & 1) {
      high += arr[r];
      r--;
    } else {
      low += arr[l];
      l++;
    }
    i++;
  }
  cout << low * low + high * high << endl;
}
