#include #include #include int main(int argc, char *argv[]) { int task_size = 0; int input = 0; double median = 0; std::vector input_array; std::cin >> task_size; for (int i = 0; i < task_size; i++) { std::cin >> input; input_array.push_back(input); } std::sort(input_array.begin(), input_array.end()); int half_size = task_size / 2; int middle_first = 0; int middle_second = 0; if (task_size % 2 != 0) { median = input_array[half_size + 1]; } else { middle_first = input_array[half_size - 1]; middle_second = input_array[half_size]; median = (middle_first + middle_second) / 2.0; } std::cout << median << std::endl; return 0; }