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