#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int n, total = 0, base = 0, length, result;
  cin >> n;
  unsigned long long int sticks[n];
  for (unsigned long long int i = 0; i < n; i++) {
    cin >> sticks[i];
    total += sticks[i];
  }
  sort(sticks, sticks + n);
  for (unsigned long long int i = 0; i < n / 2; i++) {
    base += sticks[i];
  }
  length = total - base;
  result = base * base + length * length;
  cout << result << "\n";
  return 0;
}
