#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long SZ = 107;
const long long N = 1e6 + 7;
const long long M = 1e4 + 7;
long long n, m, c;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  vector<long long> b, c;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long sm1 = 0, sm2 = 0;
  if (n % 2) {
    for (long long i = 0; i < n / 2; i++) {
      b.push_back(a[i]);
      sm1 += a[i];
    }
    for (long long i = n / 2; i < n; i++) {
      c.push_back(a[i]);
      sm2 += a[i];
    }
  } else {
    for (long long i = 0; i < n / 2; i++) {
      b.push_back(a[i]);
      sm1 += a[i];
    }
    for (long long i = n / 2; i < n; i++) {
      c.push_back(a[i]);
      sm2 += a[i];
    }
  }
  cout << sm1 * sm1 + sm2 * sm2 << "\n";
  cout << "\n";
}
signed main() {
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
