CodeEff/ECCO huggingface dataset:
# Original solution
import sys

p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def pbit(aa,L):
    for a in aa:print(format(a,"b").zfill(L))
    print()

def main():
    n=II()
    aa=[[int(c) for c in SI()] for _ in range(n-1)]
    #p2D(aa)
    
    # 人iが勝てる相手をbitで管理する
    win=[0]*n
    for i,row in enumerate(aa,1):
        for j,a in enumerate(row):
            if a:win[i]|=1<<j
            else:win[j]|=1<<i
    #pbit(win,n)

    # dpl[i]...[j,i]の範囲で優勝できるjをbitで
    # dpr[i]...[i,j]の範囲で優勝できるjをbitで
    dpl=[1<<i for i in range(n)]
    dpr=[1<<i for i in range(n)]
    for d in range(1,n):
        for i in range(n):
            j=i+d
            if j<n and dpl[j] & dpr[i+1] & win[i]:dpl[j]|=1<<i
            j=i-d
            if j>=0 and dpl[i-1] & dpr[j] & win[i]:dpr[j]|=1<<i
    #pbit(dpl,n)
    #pbit(dpr,n)
    #print(format(dpl[n-1]&dpr[0],"b").zfill(n))
    print(bin(dpl[n-1]&dpr[0]).count("1"))

main()


# Optimized solution
import sys

p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def pbit(aa,L):
    for a in aa:print(format(a,"b").zfill(L))
    print()

def main():
    n=II()
    aa=[[int(c) for c in SI()] for _ in range(n-1)]
    #p2D(aa)

    # 人iが勝てる相手をbitで管理する
    win=[0]*n
    for i,row in enumerate(aa,1):
        for j,a in enumerate(row):
            if a:win[i]|=1<<j
            else:win[j]|=1<<i
    #pbit(win,n)

    # dpl[i]...[j,i]の範囲で優勝できるjをbitで
    # dpr[i]...[i,j]の範囲で優勝できるjをbitで
    dpl=[1<<i for i in range(n)]
    dpr=[1<<i for i in range(n)]
    for d in range(1,n):
        for i in range(n-d):
            j=i+d
            if dpl[j] & dpr[i+1] & win[i]:dpl[j]|=1<<i
        for i in range(d,n):
            j=i-d
            if dpl[i-1] & dpr[j] & win[i]:dpr[j]|=1<<i
    #pbit(dpl,n)
    #pbit(dpr,n)
    #print(format(dpl[n-1]&dpr[0],"b").zfill(n))
    print(bin(dpl[n-1]&dpr[0]).count("1"))

main()
# Original solution
print((input().replace('1','-').replace('9','1').replace('-','9')))

# Optimized solution
print((1110-int(eval(input()))))
# Original solution
N=input()
for i in range(3):
    if i < 2:
        if N[i] == "1":
            print("9",end="")
        else:
            print("1",end="")
    else:
        if N[i] == "1":
            print("9")
        else:
            print("1")


# Optimized solution
print((input().translate(str.maketrans({"1":"9","9":"1"}))))
# Original solution
N=int(eval(input()))
print((1110-N))

# Optimized solution
print((1110-int(eval(input()))))
# Original solution
print((input().translate(str.maketrans({'1':'9','9':'1'}))))

# Optimized solution
print((1110-int(eval(input()))))
# Original solution
print((input().replace('1','a').replace('9','1').replace('a','9')))

# Optimized solution
print((1110-int(eval(input()))))
# Original solution
n = int(eval(input()))

lst = []
res = []

while n > 0:
    lst.append(n%10)
    n //= 10
    
lst.reverse()


for i in lst:
    if i == 1:
        res.append(9)
    elif i == 9:
        res.append(1)
    else:
        res.append(i)


S = ""

for j in res:
    S += str(j)

print(S)


# Optimized solution
N = list(str(eval(input())))
if N[0] == '9':
    N[0] = '1'
else : 
    N[0] = '9'
if N[1]=='9':
    N[1] = '1'
else:
    N[1] = '9'
if N[2] == '9':
    N[2] = '1'
else:
    N[2] = '9'
print((N[0]+N[1]+N[2]))
# Original solution
n=int(eval(input()))
print((1110-n))

# Optimized solution
print((1110-int(eval(input()))))
# Original solution
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a):
    return 1110-a

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

# Optimized solution
a=int(eval(input()))
print((1110-a))
# Original solution
n = str(eval(input()))
print((n.replace('1', 'a').replace('9', '1').replace('a', '9')))

# Optimized solution
n = str(eval(input()))
nn = []
for i in n:
  if i == '1':
    nn.append('9')
  else:
    nn.append('1')
print((''.join(nn)))
# Original solution
print((input().rstrip().replace("1","a").replace("9","1").replace("a","9")))


# Optimized solution
print((1110-int(eval(input()))))
# Original solution
x = list(map(int, input().split()))
for i in range(0, len(x)):
    if (x[i] == 0):
        print((i + 1))
        break


# Optimized solution
x = list(map(int, input().split()))
print((x.index(0) + 1))
# Original solution
a,b,c,d,e=list(map(int,input().split()))
if a==0:
  print((1))
elif b==0:
  print((2))
elif c==0:
  print((3))
elif d==0:
  print((4))
elif e==0:
  print((5))

# Optimized solution
s=list(map(int,input().split()))
a=sum(s)
print((15-a))
# Original solution
A = list(map(int, input().split()))

key = 0
for i,a in enumerate(A):
    if a == 0:
        key = i+1
        break
print(key)


# Optimized solution
print((15 - sum(list(map(int, input().split())))))
# Original solution
x = list(map(int,input().split()))
for i in range(5):
    if x[i] == 0:
        print((i+1))

# Optimized solution
x = list(map(int,input().split()))
for i in range(0, 5):
    if x[i] != 0:
        pass
    else:
    	print((i+1))
# Original solution
print((list(input().split()).index("0")+1))

# Optimized solution
n = list(map(int, input().split()))
print((n.index(0)+1))
# Original solution
l = input().split()
print((l.index('0')+1))


# Optimized solution
x = list(map(int, input().split()))
print((x.index(0) + 1))
# Original solution
a, b, c, d, e = list(map(int, input().split()))
if a == 0:
    print((1))
elif b == 0:
    print((2))
elif c == 0:
    print((3))
elif d == 0:
    print((4))
else:
    print((5))

# Optimized solution
a = list(map(int, input().split()))
print((a.index(0)+1))
# Original solution
import sys
input = sys.stdin.readline
a = list(map(int, input().rstrip().split(' ')))
 
for i in range(len(a)):
  if a[i] == 0:
    print((i+1))
    break


# Optimized solution
import sys
input = sys.stdin.readline

a = list(map(int, input().split(' ')))
 
for i in range(len(a)):
  if a[i] == 0:
    print((i+1))
    break
# Original solution
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    x = list(map(int, input().split()))
    print((x.index(0)+1))

if __name__ == "__main__":
    main()


# Optimized solution
print((list(map(int,input().split())).index(0)+1))
# Original solution
print((input().split().index("0")+1))

# Optimized solution
#!/usr/bin/env python3

print((15 - sum(map(int, input().split()))))
# Original solution
def LI():return list(map(int,input().split()))
def MI():return list(map(int,open(0).read().split()))
def I():return int(eval(input()))
def yes():print("Yes")
def no():print("No")

from collections import deque, Counter
from heapq import heappop, heappush
INF=float("inf")
# import math
# pi=math.pi

# import numpy as np

x=LI()
ans=x.index(0)
print((ans+1))

# Optimized solution
x=list(map(int,input().split()))
print((x.index(0)+1))
# Original solution
a, b, c, d, e = list(map(int, input().split()))

if a == 0:
    print((1))
elif b == 0:
    print((2))
elif c == 0:
    print((3))
elif d == 0:
    print((4))
else:
    print((5))


# Optimized solution
arr = list(map(int, input().split()))
print((arr.index(0)+1))
# Original solution
import sys

ans = []
a = list(map(int,input().split()))
for i in range(5):
    if a[i] == 0:
        ans.append(i+1)
for i in ans:
    print(i)

# Optimized solution
x = list(map(int,input().split()))
for i in range(5):
    if x[i] == 0:
        print((i+1))
# Original solution
x1, x2, x3, x4, x5 = list(map(int, input().split()))

if x1 ==0:
  print((1))
  
if x2 ==0:
  print((2))
  
if x3 ==0:
  print((3))
  
if x4 ==0:
  print((4))

if x5 ==0:
  print((5))

# Optimized solution
x = list(map(int, input().split()))

for i in range(5):
  if x[i] == 0:
    print((i + 1))
# Original solution
s = list(map(int, input().split()))

b = s.index(0)
print((b + 1))

# Optimized solution
n = list(map(int, input().split()))
s = n.index(0)
print((s + 1))
# Original solution
A=[int(_) for _ in input().split()]
B=sum(A)
S=15-B
print(S)

# Optimized solution
A=[int(_) for _ in input().split()]
print((15-sum(A)))
# Original solution
x = list(map(int, input().split())) 

for i in range(len(x)):
  if x[i] is 0:
    print((i+1))


# Optimized solution
x = list(map(int, input().split())) 

for i in range(len(x)):
  if x[i] == 0:
    print((i+1))
# Original solution
a = list(map(int, input().split()))
print((a.index(0)+1))

# Optimized solution
a = list(map(int, input().split()))

for i in range(5):
  if a[i] == 0:
    print((i+1))
# Original solution
def main():
    A = [False]*5
    B = [int(i) for i in input().split()]
    for b in B:
        if b == 0:
            continue
        A[b-1] = True
    for i, a in enumerate(A):
        if not a:
            print((i+1))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    A = [int(i) for i in input().split()]
    B = [False]*5

    for a in A:
        if a == 0:
            continue
        B[a-1] = True

    for i, b in enumerate(B):
        if not b:
            print((i+1))
            break


if __name__ == '__main__':
    main()
# Original solution
l=list(map(int,input().split()))
for i in range(5):
  if l[i]==0:
    print((i+1))
    break

# Optimized solution
l=list(map(int,input().split()))
for i in range(5):
  if l[i]!=i+1:
    print((i+1))
# Original solution
l = list(map(int, input().split()))
print((l.index(0) + 1))


# Optimized solution
print((input().split().index("0") + 1))
# Original solution
import sys
from collections import deque
from itertools import *

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

x = LS()

for i,xx in enumerate(x):
    if xx == '0':
        print((i+1))
        exit() 

# Optimized solution
#!/usr/bin/env pypy3acc submit
import sys
from collections import deque
from itertools import *
 
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
 
x = LS()
 
for i,xx in enumerate(x):
    if xx == '0':
        print((i+1))
        exit()
# Original solution
#!/usr/bin/env pypy3 submit
import sys
from collections import deque
from itertools import *
 
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
 
x = LS()
 
for i,xx in enumerate(x):
    if xx == '0':
        print((i+1))
        exit() 

# Optimized solution
#!/usr/bin/env PyPy3 submit
import sys
from collections import deque
from itertools import *
 
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
 
x = LS()
 
for i,xx in enumerate(x):
    if xx == '0':
        print((i+1))
        exit()
# Original solution
x = tuple(map(int, input().split()))
for i in range(5):
    if x[i] == 0:
        print((i+1))

# Optimized solution
x = list(map(int, input().split()))
for i in range(5):
    if x[i] == 0:
        print((i+1))
# Original solution
# -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline

A = list(map(int, input().split()))
a = A.index(0)
print((a+1))



# Optimized solution
print((list(map(int, input().split())).index(0)+1))
# Original solution
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return eval(input())
def i(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

x1 = l()
for i in range(5):
    if i+1 != x1[i]:
        print((i+1))

# Optimized solution
A = list(map(int,input().split()))
print((A.index(0)+1))
# Original solution
X = [*list(map(int, input().split()))]
for i in range(len(X)):
    if X[i] == 0: print((i+1))


# Optimized solution
print((15 - sum([*list(map(int, input().split()))])))
# Original solution
x = list(map(int, input().split()))

print((list(set(range(1, 5 + 1)) - set(x))[0]))


# Optimized solution
x = list(map(int, input().split()))

print((sum(range(1, 5 + 1)) - sum(x)))
# Original solution
X_s = list(map(int, input().split()))

for i in range(len(X_s)):
    num = X_s[i]

    if (num == 0):
        print((i + 1))

# Optimized solution
X_s = list(map(int, input().split()))
 
for i in range(len(X_s)):
    num = X_s[i]
 
    if (num == 0):
        print((i + 1))
        break
# Original solution
def main():
    *x, = list(map(int, input().split()))
    print((x.index(0) + 1))


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


# Optimized solution
def main():
    for i, x in enumerate(map(int, input().split()), start=1):
        if x == 0:
            print(i)
            return


if __name__ == '__main__':
    main()
# Original solution
nums = list(input().split())
for i, j in enumerate(nums):
    if j == '0':
        print((i+1))
        break

# Optimized solution
nums = list(input().split())
for i, j in enumerate(nums):
    if j == '0':
        print((i+1))
# Original solution
n = list(input().split())

for i in range(len(n)):
    if n[i] == "0":
        print((int(i)+1))


# Optimized solution
n = list(input().split())

print((n.index("0")+1))
# Original solution
x=list(map(int,input().split()))
print((x.index(0)+1))


# Optimized solution
print((input().find('0')//2+1))
# Original solution
l = list(map(int,input().split()))
xr = 0
for i in range(1,6):
  xr ^= i
for i in l:
  xr ^= i
print(xr)

# Optimized solution
l = list(map(int,input().split()))
xr = 0
for i in range(5):
  xr ^= (i+1)
  xr ^= l[i]
print(xr)
# Original solution
l = list(map(int,input().split()))
xr = 0
for i in range(5):
  xr ^= (i+1)
  xr ^= l[i]
print(xr)


# Optimized solution
l = list(map(int,input().split()))
xr = 0
for i in range(5):
  xr ^= (i+1)^l[i]
print(xr)
# Original solution
x = [int(i) for i in input().split()]
for i in range(5):
    if x[i] == 0:
        print((i+1))
        break

# Optimized solution
x = [int(i) for i in input().split()]
print((x.index(0)+1))
# Original solution
pos = 0
for n in map(int, input().split()):
    pos += 1
    if n == 0:
        break
print(pos)


# Optimized solution
print((sum(range(6)) - sum(list(map(int, input().split())))))
# Original solution
print((list(map(int, input().split())).index(0) + 1))

# Optimized solution
print((int(input().split().index("0"))+1))
# Original solution
a=sum(map(int, input().split()))
print((15-a))


# Optimized solution
print((15-sum(map(int, input().split()))))
# Original solution
x = list(map(int, input().split()))

xi = 0
for i in x:
    xi += 1
    if i == 0:
        print(xi)

# Optimized solution
x = list(map(int, input().split()))
ans = 15
for _ in range(len(x)):
    ans -= x[_]

print(ans)
# Original solution
a, b, c, d, e = list(map(int,input().split()))

if a == 0:
  print((1))
elif b == 0:
  print((2))
elif c == 0:
  print((3))
elif d == 0:
  print((4))
elif e == 0:
  print((5))

# Optimized solution
x=list(map(int,input().split()))
 
for i in range(5):
    if x[i]==0:
        print((i+1))
# Original solution
books1= list(map(int, input().split()))
i=0
while(i<len(books1)):
  if(books1[i]==0):
    print((i+1))
    break
    i+=1

# Optimized solution
books1= list(map(int, input().split()))
i=0
while(i<len(books1)):
  if(books1[i]==0):
    break
  i+=1
print((i+1))
# Original solution
X = [int(i) for i in input().split()]
print((X.index(0) + 1))

# Optimized solution
print((15-sum([int(i) for i in input().split()])))
# Original solution
a = list(map(int, input().split()))
b = a.index(0)
print((b+1))


# Optimized solution
x = list(map(int, input().split()))
print((x.index(0)+1))
# Original solution
m =list(map(int, input().split()))
for i in range(5):
    if m[i] == 0:
        print((i + 1))

# Optimized solution
m =list(map(int, input().split()))
for i in range(len(m)):
    if m[i] == 0:
        print((i + 1))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()

m=n//2

if a[m] == a[m-1] :print((0));exit()

print((a[m]-a[m-1]))


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()

m=n//2

print((a[m]-a[m-1]))
# Original solution
N = int(eval(input()))
K = list(map(int, input().split()))
K.sort()
num = len(K)//2
result = K[num] - K[num-1]
print(result)

# Optimized solution
n=int(eval(input()));d=sorted(map(int,input().split()));print((d[n//2]-d[n//2-1]))
# Original solution
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(eval(input()))
D = list(map(int, input().split()))
D.sort()

num = N // 2
arc = 0
for _ in range(N):
    arc_first = D.pop()
    arc += 1
    if arc == num:
        break
abc_last = D.pop()

if abc_last == arc_first:
    # 同じ数にできない
    ans = 0
else:
    ans = arc_first - abc_last

print(ans)

# Optimized solution
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(eval(input()))
D = list(map(int, input().split()))
D.sort()

num = N // 2
ans = D[num] - D[num-1]
print(ans)
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))

same = N / 2

d.sort()

distribution = [0] * d[len(d) - 1]
total = 0
for di in d:
    num = d.count(di)
    distribution[di - 1] = num

total = 0
totals = [0] * d[len(d) - 1]
num = 0
for i in range(len(distribution)):
    total += distribution[i]
    totals[i] = total

    if totals[i] == same:
        num += 1
    elif num >= 1:
        break

print(num)


# Optimized solution
N = int(eval(input()))
d = list(map(int, input().split()))

same = N / 2

# d.sort()

# distribution = [0] * d[len(d) - 1]
# total = 0
# for di in d:
#     num = d.count(di)
#     distribution[di - 1] = num

table = {}
for di in d:
    table[di] = 1 if table.get(di) is None else table.get(di) + 1
table = sorted(table.items())

total = 0
start = 0
end = 0
for difficulty, num in table:
    total += num

    if start == 0 and total == same:
        start = difficulty
    elif start != 0:
        end = difficulty
        break

# print(table, start, end)

answer = end - start
print(answer)
# Original solution
n=int(eval(input()))
v=[int(i) for i in input().split()]
v=sorted(v)
j=int((n/2))
k=int((n/2)-1)
if v[j]!=v[k]:
    print((v[j]-v[k]))
else:
    print("0")

# Optimized solution
n = int(eval(input()))

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

d.sort()

middle = int(len(d)/2)

print((d[middle] - d[middle-1]))
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))
ans = 0

same = N // 2
count = 0

for i in range(2, 10 ** 5 + 1):
    count += d.count(i - 1)
    if count == same:
        ans += 1

print(ans)

# Optimized solution
N = int(eval(input()))
d = sorted(list(map(int, input().split())))

half = d[N // 2 - 1]
nxt = d[N // 2]

if nxt == half:
    print((0))
else:
    print((nxt - (half + 1) + 1))
# Original solution
N = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
var = 0
y = d[N//2] - d[(N//2)-1]
k = d[(N//2)-1]
for j in range(y):
  k = k+1
  m = len([i for i in d if i < k])
  if m*2 == N:
    var = var + 1
print(var)

# Optimized solution
N = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
y = d[N//2] - d[(N//2)-1]
print(y)
# Original solution
n = int(eval(input()))
d_list = [int(i) for i in input().rstrip().split(' ')]

cnt = 0

for i in range(1, max(d_list)+1):
  cnt_low = 0
  cnt_high = 0
  for d in d_list:
    if i >= d:
      cnt_high += 1
    else:
      cnt_low += 1

  if cnt_high == cnt_low:
    cnt += 1
      
print(cnt)

# Optimized solution
n = int(eval(input()))
d_list = [int(i) for i in input().rstrip().split(' ')]
d_list.sort()

a = int(n/2) -1
b = int(n/2)

if d_list[a] == d_list[b]:
  print((0))
else:
  print((d_list[b] - d_list[a]))
# Original solution
n=int(eval(input()))//2
d=sorted(list(map(int,input().split())))
print((d[n]-d[n-1]))

# Optimized solution
n=int(eval(input()))//2
d=sorted(map(int,input().split()))
print((d[n]-d[n-1]))
# Original solution
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
d.sort()
k = d[int(n/2)]
while k > d[int(n/2)-1]:
   k -= 1
   ans += 1
print(ans)

# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))

d.sort()

print((d[n//2] - d[n//2 - 1]))
# Original solution
def resolve():
    n=int(eval(input()))
    l=list(map(int, input().split()))
    l.sort()
    print((l[n//2]-l[n//2-1]))
resolve()

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(eval(input()))
    l=list(map(int,input().split()))
    l.sort()
    num=n//2
    print((l[num]-l[num-1]))
resolve()
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))

ans = 0

for i in range(min(d), max(d)+1):
    d_list = [x for x in d if i <= x]

    if len(d_list) == N // 2:
        ans += 1
print(ans)


# Optimized solution
N = int(eval(input()))
d = list(map(int, input().split()))
d.sort()

print((d[N//2]-d[N//2-1]))
# Original solution
n=int(eval(input()))
d=list(map(int,input().split()))
d=sorted(d)

ans=0
for i in range(1,d[-1]+1):
    cnt=0
    for j in range(n):
        if i>d[j]:
            cnt+=1
        else:
            break
    if n-cnt==cnt:
        ans+=1
print(ans)

# Optimized solution
import bisect

n=int(eval(input()))
d=list(map(int,input().split()))
d=sorted(d)

ans=0
for i in range(1,d[-1]+1):
    if bisect.bisect_left(d,i)==n-bisect.bisect_left(d,i):
        ans+=1

print(ans)
# Original solution
# ABC132C - Divide the Problems
from statistics import median_high, median_low


def main():
    n = int(eval(input()))
    D = sorted(map(int, input().rstrip().split()))
    h, l = median_high(D), median_low(D)
    print((h - l))


if __name__ == "__main__":
    main()

# Optimized solution
# ABC132C - Divide the Problems
def main():
    n = int(eval(input()))
    D = sorted(map(int, input().rstrip().split()))
    h, l = D[n // 2], D[n // 2 - 1]
    print((h - l))


if __name__ == "__main__":
    main()
# Original solution
N=int(eval(input()))
temp=input().split()
d=[int(temp[i]) for i in range(N)]
dd=[]
for i in range(int(N/2)+1):
  dd.append(min(d))
  d.remove(min(d))
  
a=dd[int(N/2-1)]
b=dd[int(N/2)]
print((int(b-a)))

# Optimized solution
N=int(eval(input()))
temp=input().split()
d=[int(temp[i]) for i in range(N)]
d.sort()
  
a=d[int(N/2-1)]
b=d[int(N/2)]
print((int(b-a)))
# Original solution
N=int(eval(input()))
temp=input().split()
d=[int(temp[i]) for i in range(N)]

d.sort()
print((d[int(N/2)]-d[int(N/2-1)]))

# Optimized solution
n=int(eval(input()))
d=list(map(int, input().split()))

d.sort()

print((int(d[int(n/2)]-d[int(n/2-1)])))
# Original solution
N = int(eval(input()))
D = [int(x) for x in input().split()]
D.sort()

M = N//2

x,y = D[M-1:M+1]
answer = y - x
print(answer)

# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*D = list(map(int,read().split()))

n = N//2
D.sort()
answer = D[n] - D[n-1]
print(answer)