#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long arr[n + 3];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long LL, HL, sumL = 0, sumH = 0;
  LL = n / 2;
  for (int i = 0; i < LL; i++) {
    sumL += arr[i];
  }
  for (int i = LL; i < n; i++) {
    sumH += arr[i];
  }
  long long res = sumL * sumL + sumH * sumH;
  cout << res << endl;
  return 0;
}
