import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    }
}


 import java.util.*; util.* java import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io import java.awt.Point; Point java.awt public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] nums = new int[n]; nums new int[n] n String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            nums[i] = Integer.parseInt(s[i]);
        } {
            nums[i] = Integer.parseInt(s[i]);
        } nums[i] = Integer.parseInt(s[i]) nums[i] nums i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i Arrays.sort(nums) Arrays.sort Arrays nums int mid = nums.length/2; mid nums.length/2 nums.length nums nums.length 2 int ans = 0; ans 0 if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        } nums[mid] != nums[mid-1] nums[mid] nums mid nums[mid-1] nums mid-1 mid 1 {
            ans = nums[mid] - nums[mid-1];
        } ans = nums[mid] - nums[mid-1] ans nums[mid] - nums[mid-1] nums[mid] nums mid nums[mid-1] nums mid-1 mid 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] nums = new int[n];
        String[] s = br.readLine().split(" ");
        
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(s[i]);
        }
        
        Arrays.sort(nums);
        int mid = nums.length/2;
        
        int ans = 0;
        if (nums[mid] != nums[mid-1]) {
            ans = nums[mid] - nums[mid-1];
        }
        
        System.out.println(ans);
    }
}



