from collections import Counter



n = int(eval(input()))

d = list(map(int, input().split()))



minD = min(d)

maxD = max(d)

c = Counter(d)



abc = 0

arc = n

ans = 0



for i in range(minD, maxD+1):

    abc += c[i-1]

    arc -= c[i-1]

    

    if abc == arc:

        ans += 1



print(ans)
n = int(eval(input()))

d = list(map(int, input().split()))



d.sort()



print((max(0, d[n//2] - d[n//2 - 1])))
from collections import Counter

n = int(eval(input()))
d = list(map(int, input().split()))
minD = min(d)
maxD = max(d)
c = Counter(d)
abc = 0
arc = n
ans = 0
for i in range(minD, maxD + 1):
    abc += c[i - 1]
    arc -= c[i - 1]
    if abc == arc:
        ans += 1
print(ans)

n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
print((max(0, d[n // 2] - d[n // 2 - 1])))

-from collections import Counter - -minD = min(d) -maxD = max(d) -c = Counter(d) -abc = 0 -arc = n -ans = 0 -for i in range(minD, maxD + 1): -    abc += c[i - 1] -    arc -= c[i - 1] -    if abc == arc: -        ans += 1 -print(ans) +d.sort() +print((max(0, d[n // 2] - d[n // 2 - 1])))