Harryxun/stf_run huggingface dataset:
#import numpy as np
import math
import sys
import itertools
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
x,y = IL()
N = len(s)

xlist = []
ylist = []

f = 0
cnt = 0
for i in range(N):
  if s[i] == "F":
    cnt += 1
  elif s[i] == "T":
    if f == 0:
      xlist.append(cnt)
      f = 1
    else:
      ylist.append(cnt)
      f = 0
    cnt = 0
else:
  if f == 0:
    xlist.append(cnt)
  else:
    ylist.append(cnt)

x -= xlist.pop(0)
Xsum = sum(xlist)
Ysum = sum(ylist)

if (Xsum-x)%2 != 0:
  print("No")
  exit()
else:
  Xnum = (Xsum-abs(x))//2
if (Ysum-y)%2 != 0:
  print("No")
  exit()
else:
  Ynum = (Ysum-abs(y))//2

#print(Xnum,Ynum)

XDP = [[0]*(Xnum+1) for _ in range(len(xlist)+1)]
YDP = [[0]*(Ynum+1) for _ in range(len(ylist)+1)]

XDP[0][0] = 1
YDP[0][0] = 1

for i in range(1,len(xlist)+1):
  for j in range(Xnum+1):
    if XDP[i-1][j] == 1:
      XDP[i][j] = 1
      if j+xlist[i-1] < Xnum+1:
        XDP[i][j+xlist[i-1]] = 1
#print(Xnum)
#print(xlist)
#print(XDP)

for i in range(1,len(ylist)+1):
  for j in range(Ynum+1):
    if YDP[i-1][j] == 1:
      YDP[i][j] = 1
      if j+ylist[i-1] < Ynum+1:
        YDP[i][j+ylist[i-1]] = 1
#print(Ynum)
#print(ylist)
#print(YDP)

if XDP[-1][-1] == 1 and YDP[-1][-1] == 1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

#import numpy as np
import math
import sys
import itertools
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
x,y = IL()
N = len(s)

xlist = []
ylist = []

f = 0
cnt = 0
for i in range(N):
  if s[i] == "F":
    cnt += 1
  elif s[i] == "T":
    if f == 0:
      xlist.append(cnt)
      f = 1
    else:
      ylist.append(cnt)
      f = 0
    cnt = 0
else:
  if f == 0:
    xlist.append(cnt)
  else:
    ylist.append(cnt)

x -= xlist.pop(0)
Xsum = sum(xlist)
Ysum = sum(ylist)

if (Xsum-x)%2 != 0:
  print("No")
  exit()
else:
  Xnum = (Xsum-abs(x))//2
if (Ysum-y)%2 != 0:
  print("No")
  exit()
else:
  Ynum = (Ysum-abs(y))//2

#print(Xnum,Ynum)

XDP = [[0]*(abs(Xnum)+1) for _ in range(len(xlist)+1)]
YDP = [[0]*(abs(Ynum)+1) for _ in range(len(ylist)+1)]

XDP[0][0] = 1
YDP[0][0] = 1

for i in range(1,len(xlist)+1):
  for j in range(Xnum+1):
    if XDP[i-1][j] == 1:
      XDP[i][j] = 1
      if j+xlist[i-1] < Xnum+1:
        XDP[i][j+xlist[i-1]] = 1
#print(Xnum)
#print(xlist)
#print(XDP)

for i in range(1,len(ylist)+1):
  for j in range(Ynum+1):
    if YDP[i-1][j] == 1:
      YDP[i][j] = 1
      if j+ylist[i-1] < Ynum+1:
        YDP[i][j+ylist[i-1]] = 1
#print(Ynum)
#print(ylist)
#print(YDP)

if XDP[-1][-1] == 1 and YDP[-1][-1] == 1:
  print("Yes")
else:
  print("No")
N, M = input().split(" ")
N = int(N)
M = int(M)
s_list = []
c_list = []
for i in range(M):
    si, ci = input().split(" ")
    s_list.append(int(si))
    c_list.append(int(ci))
num = ["0" for i in range(N)]
for si, ci in zip(s_list, c_list):
    if num[si-1] != "0" and num[si-1] != str(ci):
        print(-1)
        is_break = True
        break
    elif N > 1 and si == 1 and ci == 0:
        print(-1)
        is_break = True
        break
    else:
        num[si-1] = str(ci)
if not is_break:
    num = int("".join([val for val in num]))
    if num:
        print(num)
    else:
        print(0)

### FIXED CODE ###

N, M = input().split(" ")
N = int(N)
M = int(M)
s_list = []
c_list = []
for i in range(M):
    si, ci = input().split(" ")
    s_list.append(int(si))
    c_list.append(int(ci))
num = ["0" for i in range(N)]
is_break = False
for si, ci in zip(s_list, c_list):
    if num[si-1] != "0" and num[si-1] != str(ci):
        print(-1)
        is_break = True
        break
    elif N > 1 and si == 1 and ci == 0:
        print(-1)
        is_break = True
        break
    else:
        num[si-1] = str(ci)
if not is_break:
    num = "".join([val for val in num])
    if int(num[0]) or N == 1:
        print(int(num))
    else:
        print(int("1" + num[1:]))
s=input()
t=input()
cnt=0
for i in range(3):
  if s[i]==t[i]:
  cnt +=1
print(cnt)

### FIXED CODE ###

s = input()
t = input()
cnt = 0
for i in range(3):
  if s[i] == t[i]:
  	cnt += 1
print(cnt)
# 全部亀でもならない合計足数に足りない
if y > x * 4:
    print('No')
# 全部鶴でも合計足数をはみ出す
elif y < x * 2:
    print('No')
# 足が奇数
elif y % 2 == 1:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

x, y = map(int, input().split())

# 全部亀でもならない合計足数に足りない
if y > x * 4:
    print('No')
# 全部鶴でも合計足数をはみ出す
elif y < x * 2:
    print('No')
# 足が奇数
elif y % 2 == 1:
    print('No')
else:
    print('Yes')
N,X = map(int,input().split())
if N == 0:
    print(1)
    exit()
# a:バンの数  b:パティの数
a,b = [1],[1]
for i in range(N):
    a.append(2*a[i] + 3)
    b.append(2*b[i] + 1)
def f(N,X):
    if X == 1:
        return 0
    elif 1 < X <= a[N-1] + 1:
        return f(N-1,X-1)
    elif X == a[N-1] + 2:
        return b[N-1] + 1
    elif a[N-1] + 2 < X <= 2*a[N-1] + 2:
        return b[N-1] + 1 + f(N-1,X-(a[N-1]+2))
    elif X = 2*a[N-1] + 3:
        return 2*b[N-1] + 1
ans = f(N,X)
print(ans)

### FIXED CODE ###

N,X = map(int,input().split())
# a:バンの数  b:パティの数
a,b = [1],[1]
for i in range(N):
    a.append(2*a[i] + 3)
    b.append(2*b[i] + 1)
def f(N,X):
    if N == 0:
        return 1
    if X == 1:
        return 0
    elif 1 < X <= a[N-1] + 1:
        return f(N-1,X-1)
    elif X == a[N-1] + 2:
        return b[N-1] + 1
    elif a[N-1] + 2 < X <= 2*a[N-1] + 2:
        return b[N-1] + 1 + f(N-1,X-(a[N-1]+2))
    elif X == 2*a[N-1] + 3:
        return 2*b[N-1] + 1
ans = f(N,X)
print(ans)
# -*- coding: <encoding name> -*-

n = int(input())
a = list(map(int(), input().split()))

A = sorted(a)
print(A[-1] - A[0])

### FIXED CODE ###

# -*- coding: <encoding name> -*-

n = int(input())
a = list(map(int, input().split()))

A = sorted(a)
print(A[-1] - A[0])
s = input()

s[3] = "8"
print(s)

### FIXED CODE ###

s = input()

print(s.replace("2017", "2018"))
line = input().split()
a = int(line[0])
b = int(line[1])
print(srt(a*b) + " " + str((a+b)*2))


### FIXED CODE ###

line = input().split()
a = int(line[0])
b = int(line[1])
print(str(a*b) + " " + str((a+b)*2))
message = input()

temp_list=list(message)


if (temp_list[2] == temp_list[3]) and (temp_list[4] == temp_list[5]):
    print("Yes")
else
    print("No")

### FIXED CODE ###

message = input()

temp_list=list(message)


if (temp_list[2] == temp_list[3]) and (temp_list[4] == temp_list[5]):
    print("Yes")
else:
    print("No")
def main():
    import collections

    N = int(input())
    A_s = list(map(int, input().split()))
    Q = int(input())

    summ = sum(A_s)
    CNT_A = collections.Counter(A_s)


    for i in range(Q):
        before, after = map(int, input().split())
        
        tmp_cnt = CNT_A[before]
        
        if (tmp_cnt > 0):
            tmp_before = CNT_A[before] * (after - before)
            summ += tmp_before

            N_before=CNT_A[before]

            del CNT_A[before]
            N_after = CNT_A[after]
            
            if (N_after > 0):
                CNT_A[after] = N_after + N_before
            else:
                CNT_A[after] = N_before
            
        
        print(summ)


if __name__ == '__main__':
    main()


### FIXED CODE ###

N = int(input())

bitts = ''
ans = ''

dic = 'abcdefghijklmnopqrstuvwxyz'

while (N > 0):
    N -= 1
    
    b = N // 26
    mod = N - 26 * b
    bitts += str(mod)
    
    ans += dic[mod]
    
    N = N // 26
    

print(ans[::-1])
N,K=map(int,input().split())
print(1 if N%K != 0 else 0)

### FIXED CODE ###

S=list(input())
K=int(input())
#print(S)
for i in range(K):
    n=int(S[i])
    if n==1:
        if K-1==i:
            print(1)
            exit(0)
    else:
        print(n)
        exit(0)
import itertools

N, M = map(int, input().split())
x = [None] * N
y = [None] * N
z = [None] * N


for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

if M == 0:
    print(0)
elif M == 1:
    vallist = [abs(x[i]) + abs(y[i]) + abs(z[i]) for i in range(N)]
    print(max(vallist))
elif M == N:
    print(abs(sum(x[i])) + abs(sum(y[i])) + abs(sum(z[i])))
else:
    ans = 0
    v = 0
    for I in itertools.combinations([i for i in range(N)], M):
        I = list(I)
        v = abs(sum([x[i] for i in I]))
        v += abs(sum([y[i] for i in I]))
        v += abs(sum([z[i] for i in I]))
        ans = max(ans, v)
    print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
x = [None] * N
y = [None] * N
z = [None] * N

for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

ans = 0

for xs in [1, -1]:
    for ys in [1, -1]:
        for zs in [1, -1]:
            D = [xs*x[i] + ys*y[i] + zs*z[i] for i in range(N)]
            D.sort(reverse=True)
            ans = max(ans, sum(D[:M]))

print(ans)
a = int(input())
b= [int(x) for x in input().split()]
c = a
for s in range(a):
  d = b[s]
  e = b[s]
  for t in b[s+1::]:
    d = d ^ t
    e = e + t
    if d == e:
      c += 1
    else:
      break
print(c)

### FIXED CODE ###

import functools
a = int(input())
S = input()
l = [0] * (a+1)
r = [0] * (a+1)
for i, s in enumerate(S):
  l[i+1] = l[i] + 1 if s=="W" else l[i]
for i,s in enumerate(S[::-1]):
  r[i+1] = r[i] + 1 if s=="E" else r[i]
b = [l[i]+r[a-1-i] for i in range(a)]
c = functools.reduce(lambda x, y: min(x, y), b)
print(c)
x = ''.join(input().split())
if x % 4 = 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

x = int(''.join(input().split()))
if x % 4 == 0:
    print('YES')
else:
    print('NO')
S = input()
S = S.split()
howMuch = S[0]
Ihave = S[1]
sutis = S[2]
 
ans = int(Ihave)/int(howMuch)
ans2 = int(sutis) * int(howMuch)
if ans < sutis:
    print(int(sutis))
else:
    print(int(ans))

### FIXED CODE ###

S = input()
S = S.split()
howMuch = int(S[0])
Ihave = int(S[1])
sutis = int(S[2])
 
if (Ihave // howMuch) < sutis:
    print(Ihave // howMuch)
else:
    print(sutis)
a,b=map(int,input().split())
ct=0
for i in range(1,a+1):
    for j in range(1,32):
        if(a!=b):
            if(i==a):
                break
        else(i==j):
            ct=ct+1
               
print(ct)


### FIXED CODE ###

a,b=map(int,input().split())
ct=0
for i in range(1,a+1):
    for j in range(1,32):
        if(a!=b):
            if(i==b):
                break
            elif(i==j):
                ct=ct+1
        elif(i==j):
            ct=ct+1
               
print(ct)
N, M = map(int, input())

if N==M:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N, M = map(int, input().split())

if N==M:
    print("Yes")
else:
    print("No")
def main():
    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))

    Ap=[x for x in A if x>=0 ]
    Am=[abs(x) for x in A if x<0]

    if K==N:
        k
        out=1
        for a in A:
            out*=a
            out%=10**9+7
        
        return


    if K%2==1 and len(Ap)==0:
        k
        Am.sort()
        out=1
        for i in range(K):
            out*=Am[i]
            out%=10**7+1
        print((-out)%(10**9+7))
        return

    Ap.sort(reverse=True)
    Am.sort(reverse=True)
    
    ap_idx=0
    am_idx=0
    result=1
    for _ in range(0,K,2):
        if K%2==0 and ap_idx+1<len(Ap):
            pmax=Ap[ap_idx]*Ap[ap_idx+1]
        elif K%2==1 and ap_idx+2<len(Ap):
            pmax=Ap[ap_idx]*Ap[ap_idx+1]
        else:
            pmax=-1

        if am_idx+1<len(Am):
            mmax=Am[am_idx]*Am[am_idx+1]
        else:
            mmax=-1

        if pmax==-1 and mmax==-1:
            break

        if pmax>mmax:
            result*=pmax
            ap_idx+=2
        else:
            result*=mmax
            am_idx+=2

        result%=(10**9+7)
    
    if K%2==1:
        result*=Ap[ap_idx]

    print(result%(10**9+7))

main()

### FIXED CODE ###

def main():
    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))

    Ap=[x for x in A if x>=0 ]
    Am=[abs(x) for x in A if x<0]

    if K==N:
        out=1
        for a in A:
            out*=a
            out%=10**9+7
        print(out)
        return


    if K%2==1 and len(Ap)==0:
        Am.sort()
        out=1
        for i in range(K):
            out*=Am[i]
            out%=10**9+7
        print((-out)%(10**9+7))
        return

    Ap.sort(reverse=True)
    Am.sort(reverse=True)
    
    ap_idx=0
    am_idx=0
    result=1

    for _ in range(0,K-1,2):
        if K%2==0 and ap_idx+1<len(Ap):
            pmax=Ap[ap_idx]*Ap[ap_idx+1]
        elif K%2==1 and ap_idx+2<len(Ap):
            pmax=Ap[ap_idx]*Ap[ap_idx+1]
        else:
            pmax=-1

        if am_idx+1<len(Am):
            mmax=Am[am_idx]*Am[am_idx+1]
        else:
            mmax=-1

        if pmax==-1 and mmax==-1:
            break

        if pmax>mmax:
            result*=pmax
            ap_idx+=2
        else:
            result*=mmax
            am_idx+=2

        result%=(10**9+7)
    
    if K%2==1:
        result*=Ap[ap_idx]

    print(result%(10**9+7))

main()
import math

a,b = map(int, input().split())
av = num =  a
n = 1
while num =< b:
  n+=1
  num = num+av-1
print(n)

### FIXED CODE ###

a = str(input())#入力S
b = str(input())#入力T
#print(a[n])
#print(b[n])
x=0
for n in range(3):
  if a[n] == b[n]:
    x+=1
print(x)
S = input()
a = len(S)
print(map(str(S[0]+a+S[-1])))

### FIXED CODE ###

S = input()
a = len(S)
print(S[0]+ str(a-2) + S[-1])
candy = [input() for i in range(3)]
candy.sort()

if candy[0] + candy[1] == candy[2]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

candy = list(map(int, input().split()))
candy.sort()

if candy[0] + candy[1] == candy[2]:
    print('Yes')
else:
    print('No')
N,M = map(int,input().split())
a=[]
for i in range(N):
  x = input().split()
  y = int(x[0])
  z = x[1:y+1]
  w = list(map(int,z))
  w.append(a)
b = []
for l in range(1:M+1):
  for j in range(N-1):
    if l in a[j] and l in a[j+1]:
      l.append(b)
    else:
      b = b
cnt=0
for k in range(1:M+1):
  n = b.count(k)
  if n==N-1:
    cnt +=1
print(cnt)
    
  
    
    
       
    


### FIXED CODE ###

N,M = map(int,input().split())
a=[]
for i in range(N):
  x = input().split()
  z = x[1:]
  a += list(map(int,z))
cnt=0
for k in range(1,M+1):
  n = a.count(k)
  if n==N:
    cnt +=1
  else:
    cnt = cnt
print(cnt)
def check_block(comb, K):
    block = 0
    pre = (comb & 1) > 0
    mapping = {0: 0}
    cut_num = 0
    for i in range(1, K):
        cur = ((1 << i) & comb) > 0
        if pre != cur:
            block += 1
            pre = cur
            cut_num += 1
        mapping[i] = block
    return mapping, cut_num

H, W, K = map(int, input().split())
graph = [input() for ele in range(H)]
#
ans = 1319203291031903
for comb in range(1<<(H-1)):
    mapping, cut_num = check_block(comb, K)
    pre = [0] * (cut_num + 1)
    gg = False
    # preprocess 
    for j in range(H):
        pre[mapping[j]] += (graph[j][0] == '1')
    for ele in pre:
        if ele > K:
            gg = True
            break
    if gg: continue

    for i in range(1, W):
        cum = pre[:]
        for j in range(H):
            cum[mapping[j]] += (graph[j][i] == '1')
        for ii in range(len(cum)):
            if cum[ii] - pre[ii] > K:
                gg = True
                break
            if cum[ii] > K:
                cut_num += 1
                for idx in range(len(cum)):
                    cum[idx] -= pre[idx]
                break
        pre = cum
        if gg: break

    if not gg:
        ans = min(ans, cut_num)
print(ans)


### FIXED CODE ###

n = int(input())
nums = list(map(int, input().split()))

num_count = {}
for num in nums:
    num_count[num] = num_count.get(num, 0) + 1

total = 0
for num, ele in num_count.items():
    total += (ele * (ele - 1)) // 2

ans = []

for num in nums:
    ans.append(total - num_count[num] + 1)
print("\n".join(list(map(str, ans))))
N,M=map(int,input().split())
mp=[[] for i in range(N+1)]
for i in range(M):
  L,R,D=map(int,input().split())
  mp[L].append([R,D])
  mp[R].append([L,-D])

dist=[None]*(N+1)

def dfs(n):
  for np,nd in mp[n]:
    if dist[np] is None:
      dist[np]=dist[n]+nd
      if not dfs(np):
        return False
    else:
      if dist[np]!=(dist[n]+nd):
        return False
  return True
ans=True
for i in range(1,N+1):
  if dist[i] is None:
    dist[i]=0
    if not dfs(i):
      ans=False
      break
if ans:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(200002)

N,M=map(int,input().split())
mp=[[] for i in range(N+1)]
for i in range(M):
  L,R,D=map(int,input().split())
  mp[L].append([R,D])
  mp[R].append([L,-D])

dist=[None]*(N+1)

def dfs(n):
  for np,nd in mp[n]:
    if dist[np] is None:
      dist[np]=dist[n]+nd
      if not dfs(np):
        return False
    else:
      if dist[np]!=dist[n]+nd:
        return False
  return True
ans=True
for i in range(1,N+1):
  if dist[i] is None:
    dist[i]=0
    if not dfs(i):
      ans=False
      break
if ans:
  print("Yes")
else:
  print("No")
#include<iostream>
using namespace std;

main(){
	string s ;
  	cin >> s; 
  	cout << s.front()<<to_string(s.length() -2 )<<s.back()<< endl;
  	return 0;
}

### FIXED CODE ###

x,*y,z=input()
print(x+str(len(y))+z)
k=int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k+1])

### FIXED CODE ###

k=int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
d={}
for i in range(n):
  if a[i] not in d:
    d[a[i]]=1
  else:
    d[a[i]]+=1
lis=sorted(d.items(),reverse=True)
for i in range(len(lis)):
  if lis[i][1]<2:
    lis.remove(lis[i])
lis.sort(reverse=True)
if len(lis)>=2:
  if lis[0][1]>=4:
    print(lis[0][0]**2)
  else:
    print(lis[0][0]*lis[1][0])
elif len(lis)==1:
  if lis[0][1]>=4:
    print(lis[0][0]**2)
  else:
    print(0)
else:
  print(0)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
lis=[]
cnt=0
for i in range(n-1):
  if a[i+1]==a[i]:
    cnt+=1
  else:
    if cnt>=1:
      lis.append([a[i],cnt])
    cnt=0
if cnt>=1:
  lis.append([a[n-1],cnt])
lis.sort(reverse=True)
if len(lis)>=2:
  if lis[0][1]>=3:
    print(lis[0][0]**2)
  else:
    print(lis[0][0]*lis[1][0])
elif len(lis)==1:
  if lis[0][1]>=3:
    print(lis[0][0]**2)
  else:
    print(0)
else:
  print(0)
n = int(input())
s = input()

s = list(s)

l1 = 'abcdefghijklmnopqrstuvwxyz'
l1 = list(l1)

#print(s)

l2 = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
l2 = list(l2)

s1 = [0]*len(s)
s2 = [0]*len(s)

for i in range(len(s)):
	s1[i] = l1.index(s[i])

print(s)    
    
#for i in range(len(s)):
#	s2[i] = l2[s1[i]+n] 

#print(s)    
    
#リスト１つずつくっつけて文字列にする
#ans = ''
#for i in range(len(s2)):
#	ans = ans + s2[i]

#print(ans)


### FIXED CODE ###

n = int(input())
s = input()

s = list(s)

l1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
l1 = list(l1)

l2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
l2 = list(l2)

s1 = [0]*len(s)
s2 = [0]*len(s)

for i in range(len(s)):
	s1[i] = l1.index(s[i])

for i in range(len(s)):
	s2[i] = l2[s1[i]+n] 

#リスト１つずつくっつけて文字列にする
ans = ''
for i in range(len(s2)):
	ans = ans + s2[i]

print(ans)
N = int(input())
A = list(map(int,input().split()))
if N==1:
    if A[0]==0:
        print(1)
    else:
        print(0)
else:
    C = {}
    for i in range(N):
        a = A[i]
        if a not in C:
            C[a]=0
        C[a] += 1
    flag = 0
    if N%2==0:
        for i in range(1,N,2):
            if C[i]==2:continue
            flag=1
            break
    else:
        for i in range(2,N,2):
            if C[i]==2:continue
            flag = 1
            break
        if C[0]!=1:
            flag = 1
    if flag==1:
        print(0)
    else:
        p = 10**9+7
        k = N//2
        ans = 1
        cnt = 1
        while cnt<=k:
            ans = (ans*2)%p
            cnt += 1
        print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if N==1:
    if A[0]==0:
        print(1)
    else:
        print(0)
else:
    C = {}
    for i in range(N):
        a = A[i]
        if a not in C:
            C[a]=0
        C[a] += 1
    flag = 0
    if N%2==0:
        for i in range(1,N,2):
            if i in C and C[i]==2:continue
            flag=1
            break
    else:
        for i in range(2,N,2):
            if i in C and C[i]==2:continue
            flag = 1
            break
        if 0 not in C or C[0]!=1:
            flag = 1
    if flag==1:
        print(0)
    else:
        p = 10**9+7
        k = N//2
        ans = 1
        cnt = 1
        while cnt<=k:
            ans = (ans*2)%p
            cnt += 1
        print(ans)
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
  if a[i] % 2 == 0 and a[i] % 3 != 0 and [i] % 5 != 0:
    print("DENIED")
    exit()
print("APPROVED")

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 != 0 and a[i] % 5 != 0:
      
      print('DENIED')
      exit()
print('APPROVED')
#!/usr/bin/env python3
import sys
# from functools import@ reduce
import numpy as np
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, M: int, a: "List[int]"):
    x = int(np.lcm.reduce(a))
    # print(type(x))
    if x > M:
        print(0)
        exit()

    t = x // 2
    ans = 1

    ans += (M-t)//x
    
    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from functools import reduce
import numpy as np
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, M: int, a: "List[int]"):

    def gcd_base(a: int, b: int):
        while b:
            a, b = b, a%b
        return a

    def gcd(*numbers):
        return reduce(gcd_base, numbers)
    
    def lcm_base(a: int, b:int):
        return a*b // gcd_base(a,b)

    def lcm(*numbers):
        return reduce(lcm_base, numbers, 1)

    def num_of_2(x):
        c = 0
        while x%2 == 0:
            c += 1
            x//=2
        return c
    
    a0 = num_of_2(a[0])
    if any([num_of_2(i) != a0 for i in a]):
        print(0)
        exit()


    x = lcm(*a)
    t = x // 2

    # def div_of_2(x: int):
    #     c = 0
    #     while x%2 == 0:
    #         c += 1
    #     return c
    
    # y = div_of_2(t)

    # if t > M or any([y != div_of_2(i) for i in a]):
    if t > M:
        print(0)
        exit()

    ans = 1
    ans += (M-t)//x
    
    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, a)

if __name__ == '__main__':
    main()