#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
int arr[8002] = { 0, };
int n, mid, input, hight = 0, alway;
double avg = 0;
cin >> n; //n: 데이터 입력 횟수
for (int i = 0; i < n; i++)
{
cin >> input; //input: 데이터 입력값
arr[4000 + input]++; //카운팅 정렬 실행
avg += input; //avg: 평균값
if (hight < arr[4000 + input]) //입력 중 최대 빈도 확인
{
hight = arr[4000 + input]; //hight: 빈도의 최댓값
alway = input; //alway: 최대의 빈도를 차지하는 수
}
}
int min, max; //max: 최댓값, min: 최솟값
min = max = input;
bool flag = false; //mid값을 초기화를 했는지 확인 용도
int cnt = 0; //최대의 빈도를 가진 수의 갯수 확인 용도
int sum = 0; //입력된 횟수 확인 용도
for (int i = 0; i < 8002; i++)
{
int value = i - 4000;
if (arr[i] > 0)
{
sum += arr[i];
if (sum >= n / 2 + 1 && !flag)
{
mid = value;
flag = true;
}
if (min > value) min = value;
if (max < value) max = value;
if (arr[i] == hight) cnt++;
if (cnt == 2) //두 번째로 작은 수만
{
cnt = 3;
alway = value;
}
}
}
cout << round(avg / n) << "\n" << mid << "\n" << alway << "\n" << max - min;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4odm9pZCkKewoJaW50IGFycls4MDAyXSA9IHsgMCwgfTsKCWludCBuLCBtaWQsIGlucHV0LCBoaWdodCA9IDAsIGFsd2F5OwoJZG91YmxlIGF2ZyA9IDA7CgoJY2luID4+IG47ICAgICAgICAvL246IOuNsOydtO2EsCDsnoXroKUg7Zqf7IiYCgoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCgl7CgkJY2luID4+IGlucHV0OyAgICAgICAgICAgIC8vaW5wdXQ6IOuNsOydtO2EsCDsnoXroKXqsJIKCQlhcnJbNDAwMCArIGlucHV0XSsrOyAgICAgLy/subTsmrTtjIUg7KCV66CsIOyLpO2WiQoKCQlhdmc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