#include using namespace std; int main() { int n, a[1000], median; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if (a[i] < a[j]) { int swap = a[j]; a[j] = a[i]; a[i] = swap; } } } int middle=n/2; if (n % 2 == 1) { median = a[middle]; } else { median = (a[middle] + a[middle - 1]) / 2; } cout << median << endl; return 0; }