Anatoly Shalyto

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Median of a multiset of integers is the smallest integer XX such that at least half of the elements of the set are less than or equal to XX.

Mode of a multiset of integers is the value that occurs the most times in the multiset. If there are multiple such values the mode is the smallest.

Imbalance of a multiset is the absolute difference between the median and the mode.

A multiset TT is a subset of a multiset SS if for every value the number of its occurrences in SS isn't less than the number of its occurrences in TT.

You are given a multiset of integers. Consider its non-empty subset with the largest imbalance. Print that imbalance.

입력

The first line contains a single integer nn (1n1051 \leq n \leq 10^5), size of the multiset.

The second line contains nn integers a_ia\_i (0a_i<109,a_ia_i+10 \leq a\_i < 10^9, a\_i \leq a\_{i+1}, elements of the multiset.

출력

Print a single integer --- the largest imbalance of some subset of the given multiset.