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