#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, arr[100000], i, sum1 = 0, sum2 = 0, mid;
  cin >> n;
  for (i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  mid = n / 2;
  for (i = 0; i < mid; i++) {
    sum1 += arr[i];
  }
  for (i = mid; i < n; i++) {
    sum2 += arr[i];
  }
  cout << (sum2 * sum2) + (sum1 * sum1) << endl;
}
