#include #include int main(){ //input int N; scanf("%d",&N); int A[1000]; for (int i = 0;i < N;i++){ scanf("%d",&A[i]); } //sort array A std::sort(A,A+N); //calculate median float median; if (N%2 == 0){ int index = N/2-1; median = 0.5*(A[index]+A[index+1]); }else{ int index = (N-1)/2; median = A[index]; } //output printf("%f\n",median); return 0; }