CodeEff/ECCO huggingface dataset:
# Original solution
from math import ceil
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
CA = Counter(A)
SCA = sorted(list(CA.items()), key=lambda x:x[0])

if len(CA) != ceil(N / 2):
  print((0))
  exit()

if N % 2 == 0:
  for i, j in zip(SCA, list(range(ceil(N / 2)))):
    if not (i[0] == 1 + j * 2 and i[1] == 2):
      print((0))
      exit()
else:
  for i, j in zip(SCA, list(range(ceil(N / 2)))):
    if j == 0:
      if not (i[0] == j * 2 and i[1] == 1 ):
        print((0))
        exit() 
    else:  
      if not (i[0] == j * 2 and i[1] == 2 ):
        print((0))
        exit()
print(((2 ** (N // 2)) % (10 ** 9 + 7)))

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
A.sort()
if n % 2 == 0:
  if A[::2] == A[1::2] == [i for i in range(1, n + 1, 2)]:
    ans = 2 ** (n // 2)
  else:
    ans = 0
else:
  if A == [0] or A[1::2] == A[2::2] == [i for i in range(2, n + 1, 2)]:
    ans = 2 ** (n // 2)
  else:
    ans = 0
print((ans % MOD))
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))
mod = 10**9 + 7
def f():
  memo = {}

  for i in l:
    if i in memo:
      memo[i] += 1
    else:
      memo[i] = 1
  
  for k, v in list(memo.items()):
    if k == 0 and not v == 1:
      return 0
    elif not k == 0 and not v == 2:
      return 0
  
  return 2**(n//2) % mod

print((f()))

# Optimized solution
n = int(eval(input()))
l = list(map(int, input().split()))
mod = 10**9+7
if n % 2 == 0 and len(set(l)) == n//2:
  print((2**(n//2)%mod))
elif not n % 2 == 0 and l.count(0) == 1:
  print((2**((n-1)//2)%mod))
else:
  print((0))
# Original solution
import math
N = int(eval(input()))
A = list(map(int, input().split()))

flag = True
if N%2 == 0:
    if 0 in A or len(set(A)) != N//2:
        flag = False
else:
    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2 + 1:
        flag = False

if  flag:
    print((2**(math.floor(N/2))%(10**9+7)))
else:
    print((0))


# Optimized solution
import math
N = int(eval(input()))
A = list(map(int, input().split()))

flag = True
if N%2 == 0:
    if 0 in A or len(set(A)) != N//2:
        flag = False
else:
    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2 + 1:
        flag = False

if  flag:
    print((2**((N//2))%(10**9+7)))
else:
    print((0))
# Original solution
def resolve():
    n = int(eval(input()))
    S = list(map(int, input().split()))
    if n % 2 == 0:
        sum_a = (1 + max(S)) * (n // 2)
    else:
        sum_a = (2 + max(S)) * (n // 2)
    if sum(S) == sum_a:
        ans = pow(2, n // 2, (10 ** 9 + 7))
    else:
        ans = 0

    print(ans)

if __name__ == '__main__':
    resolve()


# Optimized solution
def resolve():
    n = int(eval(input()))
    MOD = 10**9+7
    S = list(map(int, input().split()))

    if n % 2 == 0:
        sn = (1 + (n-1)) * (n // 2)
    else:
        sn = (2 + (n-1)) * (n//2)

    ss = sum(S)

    print(((2**(n//2))%MOD if ss == sn else 0))

if __name__ == '__main__':
    resolve()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
if n%2==1:
    dummy = [0]
    for i in range(1, 1+(len(a)-1)//2):
        dummy.append(2*i)
        dummy.append(2*i)
    if sorted(a) == dummy:
        ans = 2**((len(a)-1)//2)
else:
    dummy = []
    for i in range(1,  1+(len(a))//2):
        dummy.append(2*i - 1)
        dummy.append(2*i - 1)
    if sorted(a) == dummy:
        ans = 2**((len(a))//2)
print((ans%(10**9 + 7)))

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

if len(a)%2==1:
    tmp = [0]
    for i in range((len(a)-1)//2):
        tmp.append((i+1)*2)
        tmp.append((i+1)*2)
    if a == tmp:
        ans = (2**((len(a)-1)//2))%(10**9+7)
    else:
        ans = 0
else:
    tmp = []
    for i in range(len(a)//2):
        tmp.append(2*i+1)
        tmp.append(2*i+1)
    if a == tmp:
        ans = (2**(len(a)//2))%(10**9+7)
    else:
        ans = 0
print(ans)
# Original solution
import sys
input=sys.stdin.readline
N=int(eval(input()))
A=list(map(int,input().split()))

Devide_N=10**9+7
Rem_2_32_DN=(2**32)%Devide_N

if N%2==1:
  if A.count(0)!=1:
    print((0))
  else:
    for ch_n in range(1,(N-1)//2+1):
      if A.count(ch_n*2)!=2:
        break
      else:
        A.remove(ch_n*2)
        A.remove(ch_n*2)
    else:
      exp=(N-1)//2
      
      exp_quotient_32=exp//32
      exp_rem_32=exp%32
      Rem_ans_Devide_N=1
      for _ in range(exp_quotient_32):
        Rem_ans_Devide_N=(Rem_ans_Devide_N*Rem_2_32_DN)%Devide_N
        
      print(((Rem_ans_Devide_N*2**(exp_rem_32))%Devide_N))
      sys.exit()
    print((0))
else:
  for ch_n in range(1,N//2+1):
    if A.count(ch_n*2-1)!=2:
      break
    else:
      A.remove(ch_n*2-1)
      A.remove(ch_n*2-1)
  else:
    exp=N//2
    
    exp_quotient_32=exp//32
    exp_rem_32=exp%32
    Rem_ans_Devide_N=1
    for _ in range(exp_quotient_32):
      Rem_ans_Devide_N=(Rem_ans_Devide_N*Rem_2_32_DN)%Devide_N
      
    print(((Rem_ans_Devide_N*2**(exp_rem_32))%Devide_N))
    sys.exit()
  print((0))

# Optimized solution
import sys
input=sys.stdin.readline
N=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
Devide_N=10**9+7
Rem_2_32_DN=(2**32)%Devide_N

if N%2==1:
  if (A[0]!=0 or A[1]==0 if N>2 else A[0]!=0):
    print((0))

  else:
    del A[0]
    for ch_n in range(1,(N-1)//2+1):
      if A[0]!=ch_n*2 or A[1]!=ch_n*2:
        break
      else:
        del A[0:2]
    else:
      exp=(N-1)//2
      
      exp_quotient_32=exp//32
      exp_rem_32=exp%32
      Rem_ans_Devide_N=1
      for _ in range(exp_quotient_32):
        Rem_ans_Devide_N=(Rem_ans_Devide_N*Rem_2_32_DN)%Devide_N
        
      print(((Rem_ans_Devide_N*2**(exp_rem_32))%Devide_N))
      sys.exit()
    print((0))

else:
  for ch_n in range(1,N//2+1):
    if A[0]!=ch_n*2-1 or A[1]!=ch_n*2-1:
      break
    else:
      del A[0:2]
  else:
    exp=N//2
    
    exp_quotient_32=exp//32
    exp_rem_32=exp%32
    Rem_ans_Devide_N=1
    for _ in range(exp_quotient_32):
      Rem_ans_Devide_N=(Rem_ans_Devide_N*Rem_2_32_DN)%Devide_N
      
    print(((Rem_ans_Devide_N*2**(exp_rem_32))%Devide_N))
    sys.exit()
  print((0))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
mod=10**9+7
A.sort()
ans=1
if N%2==1:
  i=1
  if A[0]!=0:
    print((0))
    exit()
  while i<N:
    if A[i]==A[i+1] and A[i]==(i//2+1)*2:
      i+=2
      ans*=2
      ans%=mod
    else:
      print((0))
      exit()
  print(ans)
else:
  i=0
  while i<N:
    if A[i]==A[i+1] and A[i]==(i//2)*2+1:
      i+=2
      ans*=2
      ans%=mod
    else:
      print((0))
  print(ans)

# Optimized solution
def main():
  N=int(eval(input()))
  A=list(map(int,input().split()))
  mod=10**9+7
  ans=1
  A.sort()
  if N%2==0:
    for i in range(0,N,2):
      if A[i]!=A[i+1] or A[i]!=i+1:
        print((0))
        exit()
      ans=ans*2%mod
    print(ans)
  else:
    if A[0]!=0:
      print((0))
      exit()
    ans=1
    for i in range(1,N,2):
      if A[i]!=A[i+1] or A[i]!=i+1:
        print((0))
        exit()
      ans=ans*2%mod
    print(ans)
if __name__=='__main__':
  main()
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n=I()
  l=LI()

  l.sort()

  x=1
  if n%2==0:
    f=True
    for i in range(n):
      if f:
        f=False
        x*=2
        x%=mod
      else:
        f=True
      if (i//2)*2+1!=l[i]:
        return 0
    return x

  else:
    if l[0]!=0:
      return 0
    f=True
    for i in range(n-1):
      if f:
        f=False
        x*=2
        x%=mod
      else:
        f=True
      if (i//2)*2+2!=l[1:][i]:
        return 0
    return x

print((main()))


# Optimized solution
a=1000000007
n=int(eval(input()))
l=list(map(int,input().split()))
l.sort()
if n%2==1:
  if l[0]!=0:
    print((0))
    exit()
  else:
    l.remove(0)
    sh=2
    f=0
    for i in l:
      if f==0:
        if i!=sh:
          print((0))
          exit()
        else:
          f=1
      else:
        if i!=sh:
          print((0))
          exit()
        else:
          sh+=2
          f=0
  sh=(n-1)//2
  b=1
  for i in range(sh):
    b*=2
    b%=a
  print(b)
else:
  sh=1
  f=0
  for i in l:
    if f==0:
      if i!=sh:
        print((0))
        exit()
      else:
        f=1
    else:
      if i!=sh:
        print((0))
        exit()
      else:
        sh+=2
        f=0
  sh=n//2
  b=1
  for i in range(sh):
    b*=2
    b%=a
  print(b)
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n=I()
  l=LI()

  l.sort()

  if n%2==0:
    for i in range(n):
      if (i//2)*2+1!=l[i]:
        return 0
    return pow(2,n//2)%mod

  else:
    if l[0]!=0:
      return 0
    for i in range(n-1):
      if (i//2)*2+2!=l[1:][i]:
        return 0
    return pow(2,n//2)%mod

print((main()))


# Optimized solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n=I()
  l=LI()

  l.sort()

  if n%2==0:
    for i in range(n):
      if (i//2)*2+1!=l[i]:
        return 0
    return pow(2,n//2)%mod

  else:
    if l[0]!=0:
      return 0
    l.remove(0)
    for i in range(n-1):
      if (i//2)*2+2!=l[i]:
        return 0
    return pow(2,n//2)%mod

print((main()))
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n=I()
  l=LI()

  l.sort()

  if n%2==0:
    for i in range(n):
      if (i//2)*2+1!=l[i]:
        return 0
    return pow(2,n//2)%mod

  else:
    if l[0]!=0:
      return 0
    l=l[1:]
    for i in range(n-1):
      if (i//2)*2+2!=l[i]:
        return 0
    return pow(2,n//2)%mod

print((main()))


# Optimized solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n=I()
  l=LI()

  l.sort()

  if n%2==0:
    for i in range(n//2):
      if l[i]!=i//2*2+1:
        return 0
  else:
    if l[0]!=0:
      return 0
    for i in range(1,n):
      if -(-i//2)*2!=l[i]:
        return 0
  return pow(2,n//2)%mod

print((main()))
# Original solution
def index(n:int, a: int):
    if a % 2 == 0:
        i = n // 2 - a // 2
        j = (i + 1) * -1
        return (i, j) if i != n // 2 else (i,)
    else:
        i = (n // 2 - 1) - (a - 1) // 2
        j = (i + 1) * -1
        return (i, j)

n = int(eval(input()))
line = [0 for _ in range(n)]
for a in map(int, input().split()):
    for i in index(n, a):
        line[i] += 1
else:
    if n == 1 and line == [1]:
        print((1))
    elif n % 2 == 0 and set(line) == {2}:
        print((2 ** (n // 2) % (10 ** 9 + 7)))
    elif n % 2 == 1 and set(line) == {1, 2} and line[n//2] == 1:
        print((2 ** ((n - 1) // 2) % (10 ** 9 + 7)))
    else:
        print((0))

# Optimized solution
n = int(eval(input()))
a = [int(x) for x in input().split()]
line = [abs(i - (n - i - 1)) for i in range(n)]
if sorted(a) == sorted(line):
    print(((2 ** (n // 2)) % (10 ** 9 + 7)))
else:
    print((0))
# Original solution
from collections import Counter
mod = 10 ** 9 + 7
n = int(eval(input()))
A = Counter([int(i) for i in input().split()])

ans = 0
if n % 2 == 1:
    for k, v in list(A.items()):
        if k == 0 and v != 1:
            ans = 0
            break
        elif v >= 3:
            ans = 0
            break
        elif v == 2:
            ans += 1
else:
    for k, v in list(A.items()):
        if v != 2:
            ans = 0
            break
        else:
            ans += 1
            
if n == 1:
    if A[0] == 1:
        print((1))
    else:
        print((0))
elif ans == 0:
    print((0))
else:
    print((2 ** ans % mod))

# Optimized solution
from collections import Counter
mod = 10 ** 9 + 7
n = int(eval(input()))
A = Counter([int(i) for i in input().split()])

flag = 0
cnt = 0
if n % 2 == 1:
    for k, v in list(A.items()):
        if  k != 0 and v == 2:
            cnt += 1
        elif k == 0 and v == 1:
            pass
        else:
            flag = 1
else:
    for k, v in list(A.items()):
        if v == 2:
            cnt += 1
        else:
            flag = 1
            
if flag == 1:
    print((0))
else:
    print((2 ** cnt % mod))
# Original solution
import queue, math
while True:
    l = 0; r = []
    try:
        inp = list(map(int, input().split()))
        l = inp[0]
        r = inp[1:]
    except EOFError:
        break
    n = len(r)
    if 2*sum(r) < l:
        print("OK")
    else:
        que = queue.PriorityQueue()
        dp = [[1000.0 for i in range(n)] for j in range(2**n)]
        que.put((0.0, 0, -1))
        while not que.empty():
            co, state, last = que.get()
            if last!=-1 and dp[state][last] < co:
                continue
            for i in range(n):
                if (state & (1<<i))==0:
                    nxt = co + math.sqrt(r[last]*r[i])*2.0 if last!=-1 else r[i]
                    if nxt < dp[state | (1<<i)][i]:
                        dp[state | (1<<i)][i] = nxt
                        que.put((nxt, state | (1<<i), i))
        ans = 1000.0
        for i in range(n):
            ans = min(ans, dp[2**n-1][i]+r[i])
        print("OK" if ans < l+0.000000001 else "NA")

# Optimized solution
import queue, math
while True:
    l = 0; r = []
    try:
        inp = list(map(int, input().split()))
        l = inp[0]
        r = inp[1:]
    except EOFError:
        break
    n = len(r)
    if 2*sum(r) <= l:
        print("OK")
    else:
        n2 = 2**n-1
        que = queue.PriorityQueue()
        dp = [[1000.0 for i in range(n)] for j in range(2**n)]
        que.put((0.0, 0, -1))
        ok = False
        while not ok and not que.empty():
            co, state, last = que.get()
            if last!=-1 and dp[state][last] < co:
                continue
            for i in range(n):
                if (state & (1<<i))==0:
                    nxt = co + math.sqrt(r[last]*r[i])*2.0 if last!=-1 else r[i]
                    nst = state | (1<<i)
                    if nxt + r[i] < l+0.000000001 and nxt < dp[nst][i]:
                        if nst==n2:
                            ok = True
                            break
                        dp[nst][i] = nxt
                        que.put((nxt, nst, i))
        print("OK" if ok else "NA")
# Original solution
import sys
from math import sqrt


def rec(state, v):
    if state == (1 << N) - 1:
        return cakes[v]
    if dp[state][v] != -1:
        return dp[state][v]

    ret = INF
    for i in range(N):
        if not (state >> i & 1):
            ret = min(ret, rec(state | 1 << i, i) + sqrt(pow(cakes[i] + cakes[v], 2) - pow(cakes[i] - cakes[v], 2)))
    dp[state][v] = ret
    return ret


testcases = [[int(x) for x in line.split()] for line in sys.stdin.readlines()]

for testcase in testcases:
    box, *cakes = testcase
    N = len(cakes)
    INF = box + 1
    ans = INF
    for i in range(N):
        dp = [[-1] * N for _ in range(1 << N)]
        ans = min(ans, rec(1 << i, i) + cakes[i])
    print(('OK' if ans <= box else 'NA'))

# Optimized solution
import sys
from math import sqrt


def rec(state, v):
    if state == (1 << N) - 1:
        return cakes[v]
    if dp[state][v] != -1:
        return dp[state][v]

    ret = INF
    for i in range(N):
        if state == 0:
            ret = min(ret, rec(1 << i, i) + cakes[i])
        elif not (state >> i & 1):
            ret = min(ret, rec(state | 1 << i, i) + sqrt(pow(cakes[i] + cakes[v], 2) - pow(cakes[i] - cakes[v], 2)))
    dp[state][v] = ret
    return ret


testcases = [[int(x) for x in line.split()] for line in sys.stdin.readlines()]

for testcase in testcases:
    box, *cakes = testcase
    N = len(cakes)
    INF = box + 1
    dp = [[-1] * N for _ in range(1 << N)]
    print(('OK' if rec(0, 0) <= box else 'NA'))
# Original solution
import sys
from math import sqrt

testcases = [[int(x) for x in line.split()] for line in sys.stdin.readlines()]

for testcase in testcases:
    box, *cakes = testcase
    N = len(cakes)
    INF = box + 1
    dp = [[INF] * N for _ in range(1 << N)]
    dp[(1 << N) - 1][0] = 0
    for state in reversed(list(range(1 << N))):
        for v in range(N):
            if not dp[state][v]:
                continue
            for u in range(N):
                if not (state >> u & 1):
                    dp[state][v] = min(dp[state][v], dp[state | 1 << u][u] + sqrt(pow(cakes[u] + cakes[v], 2) - pow(cakes[u] - cakes[v], 2)))
    print(('OK' if min(dp[0]) <= box else 'NA'))

# Optimized solution
import sys
from math import sqrt


def rec(state, v):
    if state == (1 << N) - 1:
        return cakes[v]
    if dp[state][v] != -1:
        return dp[state][v]

    ret = INF
    for u in range(N):
        if state == 0:
            ret = min(ret, rec(1 << u, u) + cakes[u])
        elif not (state >> u & 1):
            ret = min(ret, rec(state | 1 << u, u) + sqrt(pow(cakes[u] + cakes[v], 2) - pow(cakes[u] - cakes[v], 2)))
    dp[state][v] = ret
    return ret


testcases = [[int(x) for x in line.split()] for line in sys.stdin.readlines()]

for testcase in testcases:
    box, *cakes = testcase
    N = len(cakes)
    INF = box + 1
    dp = [[-1] * N for _ in range(1 << N)]
    print(('OK' if rec(0, 0) <= box else 'NA'))
# Original solution
import sys,itertools
for s in sys.stdin:
  a=list(map(int,s.split(" ")))
  w=a[0]
  n=len(a)-1
  A=itertools.permutations(a[1:],n)
  s0=1e9
  for e in A:
    s=e[0]+e[-1]
    for i in range(n-1): s+=2*(e[i]*e[i+1])**.5
    if s<s0: s0=s
    if s0<=w: break
  print(["OK","NA"][s0>w])

# Optimized solution
import sys
for s in sys.stdin:
  a=list(map(int,s.split(" ")))
  w=a[0]
  a=sorted(a[1:])
  n=len(a)
  A=[]
  A.append(a.pop(0))
  while a:
    A=[a.pop()]+A
    if a==[]: break
    A+=[a.pop()]
    if a==[]: break
    A=[a.pop(0)]+A
    if a==[]: break
    A+=[a.pop(0)]
  a=A[0]+A[-1]
  for i in range(n-1): a+=2*(A[i]*A[i+1])**.5
  print(["OK","NA"][a>w])
# Original solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
s=n*a
dp=[[[0 for i in range(s+1)] for j in range(n+1)] for k in range(n+1)]
dp[0][0][0]=1
for i in range(n):
  for j in range(i+2):
    for k in range(s+1):
      if(k>=x[i]):
        dp[i+1][j][k]=dp[i][j-1][k-x[i]]+dp[i][j][k]
      else:
        dp[i+1][j][k]=dp[i][j][k]
outp=0
for i in range(1,n+1):
  outp+=dp[n][i][i*a]
print(outp)

# Optimized solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
y=[]
for i in x:
  y.append(i-a)
s=2*n*a
dp=[[0 for i in range(s+1)] for j in range(n+1)]
dp[0][n*a]=1
for i in range(n):
  for j in range(s+1):
    x=j-y[i]
    if(0<=x and x<=2*n*a):
      dp[i+1][j]=dp[i][j-y[i]]+dp[i][j]
    else:
      dp[i+1][j]=dp[i][j]

print((dp[n][n*a]-1))
# Original solution
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, A = list(map(int, input().split()))
X = list(map(int, input().split()))

dp = [[0] * 2501 for _ in range(51)]

dp[0][0] = 1
for i in range(N):
    x = X[i]
    for j in range(i, -1, -1):
        for k in range(2501):
            if k < x:
                continue
            dp[j + 1][k] += dp[j][k - x]
ans = 0
for i in range(1, 51):
    ans += dp[i][i * A]
print(ans)



# Optimized solution
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = [x - A for x in X]

dp = [0] * 5010
dp[2500] = 1

for y in Y:
    r = []
    if y >= 0:
        r = list(range(5009, -1, -1))
    else:
        r = list(range(5010))
    for i in r:
        if i - y < 0 or i - y >= 5010:
            continue
        dp[i] += dp[i - y]
print((dp[2500] - 1))
# Original solution
N, A = list(map(int, input().split()))

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


dp = [[[0 for _ in range(50*N + 1)] for _ in range(N+1)] for _ in range(N+1)]

dp[0][0][0] = 1


# i番目までのカードが選べる時にj-1枚選んでありｊ枚目にiを選ぶとき合計がA*(j)になるかどうか
# dp[i][j][k] : j-1枚選んでいてiを次に選んだ時に合計がｋになる組の数
for i in range(N+1):
    for j in range(i+1):
        for k in range(50*j + 1):
            # カードを選択するが、i番目のカードを選んでも合計がkに一致しない
            if i >= 1 and k < X[i-1]:
                # i番目を使っても合計がｋにならないなら、i-1枚目までで作った時と同じ組の数
                dp[i][j][k] = dp[i-1][j][k]
            
            # i番目のカードをj枚目に選んで合計がｋになるものがある場合。
            # k >= X[i-1] がなんとなく直感と一致しない気もするが、ｋは０～枚数＊目標平均値の範囲の値をとるのでこれでいい
            elif i >= 1 and j >= 1 and k >= X[i-1]:
                # i-1番目までで合計がｋになる個数＋ｊ-1番目までの合計がｋ-X[i]
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k - X[i-1]]


ans = 0
# N枚目までからi枚選んだ時に平均がA（合計がA*i）になる個数をi=１～Nまで見る
for i in range(1, N+1):
    ans += dp[N][i][i*A]

print(ans)

# Optimized solution
N,A = list(map(int, input().split()))
X = list(map(int, input().split()))

# i番目までからｊ枚選んで合計がｋ
dp = [[[0 for _ in range(50*N + 1)] for _ in range(N+1)] for _ in range(N+1)]
# 何も選ばず平均が０
dp[0][0][0] = 1

#全てのカードについてみる
#i-1番までからj-1枚選んで、j番目にiを選択したときの合計がA*jになるかどうか
for i in range(N+1):
    #i-1番目までからj-1枚選んであるので、最大でi-1枚選んである
    for j in range(i+1):
        # ｋは合計値
        for k in range(50*j + 1):
            # i番目を選んで合計がｋになるには、i番目の値がｋより小さくなければならない
            if i >= 1 and k < X[i-1]:
                # i番目がｋより大きいから、i-1番目までで合計がｋになる組の個数と同じ
                dp[i][j][k] = dp[i-1][j][k]
            # 
            elif i >= 1 and j >= 1 and k >= X[i-1]:
                #i番目を選んで合計がｋになるとき、ｋがi番目より大きい＆i-1からj-1枚選んだ時に合計がｋ－X[i-1]と、i-1番目まででできるやつ
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k - X[i-1]]

ans = 0
for i in range(1, N+1):
    #N枚からi枚選んで合計がi*A
    ans += dp[N][i][i*A]

print(ans)
# Original solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
for i in range(n):
  x[i]-=a
dp=[]
for i in range(n+1):
  dp.append([])
  for i in range(6000):
    dp[-1].append(0)
dp[0][3000]=1
for i in range(n):
  for j in range(6000):
    if j+x[i]<6000 and j+x[i]>=0:
      dp[i+1][j+x[i]]+=dp[i][j]
      dp[i+1][j]+=dp[i][j]
print((dp[n][3000]-1))


# Optimized solution
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))
dic={}
dic2=dic.copy()
for i in range(n):
  for j in dic:
    if j+x[i]-a in dic2:
      dic2[j+x[i]-a]+=dic[j]
    else:
      dic2[j+x[i]-a]=dic[j]
  if x[i]-a in dic2:
    dic2[x[i]-a]+=1
  else:
    dic2[x[i]-a]=1
  dic=dic2.copy()
if 0 in dic:
  print((dic[0]))
else:
  print((0))