#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int vert = 0;
  long long int horiz = 0;
  sort(a, a + n, greater<int>());
  for (int i = 0; i < ceil((double)(n) / 2); i++) {
    vert += a[i];
  }
  for (int i = ceil((double)(n) / 2); i < n; i++) {
    horiz += a[i];
  }
  cout << (long long int)(pow(vert, 2) + pow(horiz, 2)) << endl;
}
