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