#include<stdio.h>
#include<algorithm>
int n;
int a[200100];
int ans;
int main(){
int i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
std::sort(a,a+n);
ans=1999999999;
if(n%2==0){
for(i=0;i+n/2<n;i++){
if(a[i+n/2]-a[i]<ans){
ans=a[i+n/2]-a[i];
}
}
}
else{
j=0;
for(i=0;i+(n+1)/2<n;i++){
while(j<n-1&&a[i+(n+1)/2]+a[i]>a[j]+a[j+1]){
j++;
}
if(ans>a[i+(n+1)/2]-a[j])ans=a[i+(n+1)/2]-a[j];
if(ans>a[j]-a[i])ans=a[j]-a[i];
}
}
printf("%d",ans);
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8YWxnb3JpdGhtPgppbnQgbjsKaW50IGFbMjAwMTAwXTsKaW50IGFuczsKaW50IG1haW4oKXsKCWludCBpLGo7CglzY2FuZigiJWQiLCZuKTsKCWZvcihpPTA7aTxuO2krKyl7CgkJc2NhbmYoIiVkIiwmYVtpXSk7Cgl9CglzdGQ6OnNvcnQoYSxhK24pOwoJYW5zPTE5OTk5OTk5OTk7CglpZihuJTI9PTApewoJCWZvcihpPTA7aStuLzI8bjtpKyspewoJCQlpZihhW2krbi8yXS1hW2ldPGFucyl7CgkJCQlhbnM9YVtpK24vMl0tYVtpXTsKCQkJfQoJCX0KCX0KCWVsc2V7CgkJaj0wOwoJCWZvcihpPTA7aSsobisxKS8yPG47aSsrKXsKCQkJd2hpbGUoajxuLTEmJmFbaSsobisxKS8yXSthW2ldPmFbal0rYVtqKzFdKXsKCQkJCWorKzsKCQkJfQoJCQlpZihhbnM+YVtpKyhuKzEpLzJdLWFbal0pYW5zPWFbaSsobisxKS8yXS1hW2pdOwoJCQlpZihhbnM+YVtqXS1hW2ldKWFucz1hW2pdLWFbaV07CgkJfQoJfQoJcHJpbnRmKCIlZCIsYW5zKTsKCXJldHVybiAwOwp9Cg==