#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n], s1 = 0, s2 = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (long long i = 1; i <= n; i++) {
    if (i <= n / 2)
      s1 += a[i];
    else
      s2 += a[i];
  }
  long long t1 = pow(s1, 2), t2 = pow(s2, 2);
  cout << t1 + t2;
}
