#include <bits/stdc++.h>
using namespace std;
const int MX = 1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> elems;
  for (int i = 0; i < n; i++) {
    int elem;
    cin >> elem;
    elems.push_back(elem);
    ;
  }
  sort(elems.begin(), elems.end());
  long long dy = 0;
  long long dx = 0;
  int l = 0;
  int r = n - 1;
  while (l <= r) {
    dy += elems[r];
    dx += elems[l];
    if (l == r) {
      dx -= elems[l];
    }
    r--;
    l++;
  }
  cout << (dy * dy + dx * dx) << '\n';
  ;
}
