#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 sumx = 0;
  int sumy = 0;
  for (int i = 0; i < n; i++) {
    if (i < n / 2)
      sumy += arr[i];
    else
      sumx += arr[i];
  }
  long long answ = 1LL * sumx * sumx + 1LL * sumy * sumy;
  cout << answ;
  return 0;
}
