#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s = 0, s2 = 0;
  int n, m;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  m = n / 2;
  for (int i = 0; i < m; i++) s = s + arr[i];
  for (int i = m; i < n; i++) s2 = s2 + arr[i];
  cout << s * s + s2 * s2 << endl;
  return 0;
}
