#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  long long hl = accumulate(a.begin(), a.begin() + n / 2, 0);
  long long hr = accumulate(a.begin() + n / 2, a.end(), 0);
  cout << hl * hl + hr * hr << endl;
}
