#include <bits/stdc++.h>
using namespace std;
long long n, a[100001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long tmp1 = 0, tmp2 = 0;
  for (int i = 0; i < n / 2; i++) {
    tmp1 += a[i];
  }
  for (int i = n / 2; i < n; i++) {
    tmp2 += a[i];
  }
  cout << tmp1 * tmp1 + tmp2 * tmp2 << "\n";
}
