Harryxun/stf_run huggingface dataset:
n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(a[i],l)
s=0
l-=1
for i in range(n):
    s+=l%a[i]
print(s)

### FIXED CODE ###

def lcm(a,b):
    return a*b//(gcd(a,b))
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(a[i],l)
s=0
l-=1
for i in range(n):
    s+=l%a[i]
print(s)
N,A,B,C,D =list(map(int,input().split()))
s = input()
flag = 0
if C<D:
    if (s[B-1:D].count('##') == 0) and (s[A-1:C].count('##') == 0):
        print('Yes')
    else:
        print('No')
else:
    if (s[B-1:C].count('...')>=1) and (s[A-1:C].count('##')==0):
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

import sys,collections
input = sys.stdin.readline

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

if sum(a) == 0:
    print('Yes')
    exit()

if N%3 != 0:
    print('No')
    exit()    

ac = collections.Counter(a)

if len(ac) == 2 and ac[0] ==N/3:
    print('Yes')
    exit()


if len(ac) != 3 :
    print('No')
    exit()
else:
    lk1,lk2,lk3 = ac.keys()
    lv1,lv2,lv3 = ac.values()
if lv1 == lv2 ==lv3:
    if lk1^lk2 == lk3:
        print('Yes')
    else:
        print('No')
else:
    print('No')
    exit()
N, K = map(int, input().split())
ans = int(N)
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))
    print(N_1)
    print(N_2)

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
ans = int(N)
N_1 = N
N_2 = N
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
    if ans > abs(N):
        ans = abs(N)
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)
x,t = int(input())

if x >= t:
  print(x-t)
else:
  print(0)

### FIXED CODE ###

x,t = map(int,input().split())
 
if x >= t:
  print(x-t)
else:
  print(0)
a=input()
a.replace("/","")
print("Heisei" if int(a)<=2019430 else "TBD")

### FIXED CODE ###

a=input()
print("Heisei" if int(a.replace("/", ""))<=20190430 else "TBD")
from operator import itemgetter
from itertools import accumulate
 
n = int(input())
a = sorted(tuple(map(int, reversed(input().split())) for _ in range(n)))
c, d = (map(itemgetter(i), a) for i in (0, 1))
print('YNeos'[any(x < y for x, y in zip(c, accumulate(d)))::2])

### FIXED CODE ###

from itertools import accumulate

n = int(input())
a = sorted(tuple(map(int, input().split()))[::-1] for _ in range(n))
c, d = zip(*a)
print('YNeos'[any(x < y for x, y in zip(c, accumulate(d)))::2])
I,*U=N,*D=9**9,
P,*L='x+y,',
M,*R='x-y,',
for t in[*open(n:=0)][1:]:*z,u=t.split();exec(u+'+=[*map(int,z)],')
for*A,S in(D,U,'x,y,'),(U,R,P+M),(L,U,M+P),(L,R,'y,x,'),(D,R,M+P),(L,D,P+M):
 for x,y,r in eval('sorted((%sQ)for Q,P in enumerate(A)for x,y in P)'%S):
  if r:n,p=x,y
  elif x==n:N=min(N,y-p)
print(N%I*5or'SAFE')

### FIXED CODE ###

d=[[],[],[],[]]
for t in[*open(0)][1:]:*z,u=t.split();d[ord(u)%5]+=[*map(int,z)],
I=N=9**9
P,M='x+y,','x-y,'
for*A,S in(3,0,'x,y,'),(1,2,'y,x,'),(0,2,P+M),(1,3,P+M),(1,0,M+P),(3,2,M+P):
 n=p=-I
 for x,y,r in eval('sorted((%sQ)for Q,P in enumerate(A)for x,y in d[P])'%S):
  if r:n,p=x,y
  elif x==n:N=min(N,y-p)
print(N%I*5or'SAFE')
#メモ化再起
N = int(input())
H = list(map(int, input().split()))

INF = 10**4 + 1
minlist = [INF]*N
def minstepsearch(i):
    if i == 0:
        minlist[i] = 0
        return 0
    
    minlist[i] = min(minlist[i], minstepsearch(i-1) + abs(H[i] - H[i-1]))
    if i > 1:
        minlist[i] = min(minlist[i], minstepsearch(i-2) + abs(H[i] - H[i-2]))
    return minlist[i]

print(minstepsearch(N-1))

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))

minlist = [0]*N
minlist[0] = 0
minlist[1] = abs(H[1] - H[0])
for i in range(2,N):
    minlist[i] = min(minlist[i-2] + abs(H[i-2] - H[i]), minlist[i-1] + abs(H[i-1] - H[i]))

print(minlist[N-1])
z = int(input())
m,l = z.split()
print({} {}.format(m*l,m*2+l*2))

### FIXED CODE ###

z = input()
m,l = z.split()
s = int(m) * int(l)
n = int(m)*2 + int(l)*2

print("{} {}".format(str(s),str(n)))
S = input()
N = len(S)
K = int(input())

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

def rec(i, k, isSmaller):
    if i == N:
        if k == 0:
            return 1
        else:
            return 0
    
    if k == 0:
        return 1
    
    if isSmaller:
        return cmb(N-i, k) * pow(9, k)
    else:
        if S[i] == '0':
            return rec(i+1, k, False)
        else:
            zero = rec(i+1, k, True)
            between = rec(i+1, k-1, True) * (S[i] - '1')
            same = rec(i+1, k-1, False)
            return zero + between + same

print(rec(0, K, False))

### FIXED CODE ###

S = input()
N = len(S)
K = int(input())

MOD = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

# 必要なだけforを回す
for i in range(2, 10 ** 6):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

# nCr n個から重複を許さずr個の組み合わせを選ぶ
def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD

def rec(i, k, isSmaller):
    if i == N:
        if k == 0:
            return 1
        else:
            return 0
    
    if k == 0:
        return 1
    
    if isSmaller:
        return cmb(N-i, k) * pow(9, k)
    else:
        if S[i] == '0':
            return rec(i+1, k, False)
        else:
            zero = rec(i+1, k, True)
            between = rec(i+1, k-1, True) * (int(S[i]) - 1)
            same = rec(i+1, k-1, False)
            return zero + between + same

print(rec(0, K, False))
import math
a=list(map(int,input().split()))
ans=0
i=0
if max(a)-min(a)>=2:
    pass
else:
    if a[0]==a[1]:
        ans=math.factorial(max(a))
        ans=ans*ans*2
    else:
        ans=math.factorial(max(a))
        ans=ans*ans/max(a)
        #print(ans)

print(int(ans%1000000007 ))

### FIXED CODE ###

import math
a=list(map(int,input().split()))
ans=0
if max(a)-min(a)>=2:
    print(0)
else:
    if a[0]==a[1]:
        ans=math.factorial(max(a))
        ans=(ans%1000000007)*(ans%1000000007)*2
    else:
        ans=math.factorial(max(a))
        ans1 = math.factorial(min(a))
        ans=(ans%1000000007)*((ans1)%1000000007)
    print(int(ans%1000000007 ))
a, b, k = map(int, input().split())

num = list(range(a, b + 1))

a_k = num[:k]
k_e = num[-k:]

# print(a_k, k_e)
ans_set = set(a_k + k_e)
ans_list = list(ans_set)
ans_list.sort()
for i in ans_list:
    print(i)


### FIXED CODE ###

a,b,k=map(int,input().split())
r=range(a,b+1)
for i in sorted(set(r[:k])|set(r[-k:])):
  print(i)
n,q = (int(i) for i in input().split())
s = input()
x = [(i for i in input().split()) for i in range(q)]
l,r,s,f,R = 0,n+1,"#"+s+"#",1,0
while l+1<r:
    now = (l+r)//2
    for i,j in x:
        if s[now]==i:
            if j=="L": now-=1
            else: now+=1
        if now*(now-n-1)==0: break
    if now*(now-n-1) and f: f,R = 0,(l+r)//2
    if now: r = (l+r)//2
    else: l = (l+r)//2
L,r = l,n+1
if R: l = R
while l+1<r:
    now = (l+r)//2
    for i,j in x:
        if s[now]==i:
            if j=="L": now-=1
            else: now+=1
        if now*(now-n-1)==0: break
    if now-n-1: l = (l+r)//2
    else: r = (l+r)//2
print(r-L-1)

### FIXED CODE ###

n,q = (int(i) for i in input().split())
s = input()
x = [[i for i in input().split()] for i in range(q)]
l,r,s = 0,n+1,"#"+s+"#"
for i,j in x[::-1]:
    if l<=n and s[l+1]==i and  j=="L": l+=1
    elif s[l]==i and j=="R": l-=1
    if s[r-1]==i and j=="R": r-=1
    elif s[r]==i and j=="L": r+=1
print(max(0,r-l-1))
mylist = list(map(int, myinput.split(" ")))
H = mylist[0]
A = mylist[1]
x = 0
while H >0:
  H -= A
  x += 1
print(x)

### FIXED CODE ###

input_1 = input()
mylist = list(map(int, input_1.split(" ")))
H = mylist[0]
A = mylist[1]
if H % A != 0:
  answer = H//A + 1
else:
  answer = H//A
print(answer)
h,w = map(int,input().split())
Array = [list(map(str,input())) for _ in range(h)]
dx = [1,1,0,-1,-1,-1,0,1]
dy = [0,1,1,1,0,-1,-1,-1]
for i in range(h):
  for j in range(w):
    if Array[i][j]='#':
      continue
    num=0
    for d in range(8):
      ni = i+dy[d]
      nj = j+dx[d]
      if ni<0 or h<=ni:
        continue
      if nj<0 or w<=nj:
        continue
      if Array[ni][nj]=='#':
        num=num+1
    Array[i][j]=str(num)
    
for i in Array:
  print(*i)

### FIXED CODE ###

h,w = map(int,input().split())
Array = [list(map(str,input())) for _ in range(h)]
dx = [1,1,0,-1,-1,-1,0,1]
dy = [0,1,1,1,0,-1,-1,-1]
for i in range(h):
  for j in range(w):
    if Array[i][j]=='#':
      continue
    num=0
    for d in range(8):
      ni = i+dy[d]
      nj = j+dx[d]
      if ni<0 or h<=ni:
        continue
      if nj<0 or w<=nj:
        continue
      if Array[ni][nj]=='#':
        num=num+1
    Array[i][j]=str(num)
    
for i in Array:
  print(*i, sep='')
r,g,b = map(int, input().split)
x = 100*r +10*g +b
if x % 4 == 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

r,g,b = map(int, input().split())
x = 100*r +10*g + b
if x % 4 == 0:
    print('YES')
else:
    print('NO')
i=0
while True:
    i+=1
    x=input()
    if x==0:
        break
    else:
        print ("Case "+str(i)+": "+str(x))

### FIXED CODE ###

i=0
while True:
    i+=1
    x=int(input())
    if x == 0:
        break
    print("Case ",i,": ",x,sep="")
#C
A,B,C,D,E,F=map(int,input().split())
density=0
Ans1=0
Ans2=0
water=set() #setを使うと重複がなくなる
sugar=set()

bm=F//(100*B)
for i in range(bm+1):
    rw=F-100*i*B
    am=rw//(100*A)
    for j in range(am+1):
        water.add(100*i*B+100*j*A)

dm=F//D
for i in range(dm+1):
    rs=F-i*D
    cm=rs//C
    for j in range(cm+1):
        sugar.add(i*D+j*C)
sugar=sorted(sugar)
water=sorted(water)
for s in sugar:
    for w in water:
        if w/100*E<s:
            pass
        elif s+w>F or s+w==0:
            pass
        else
            den=s/(s+w)
            if den>density:
                density=den
                Ans1=s+w
                Ans2=s
            else:
                pass
print(Ans1,Ans2)

### FIXED CODE ###

#C
A,B,C,D,E,F=map(int,input().split())
density=0
Ans1=0
Ans2=0
water=set() 
sugar=set()

bm=F//(100*B)
for i in range(bm+1):
    rw=F-100*i*B
    am=rw//(100*A)
    for j in range(am+1):
        water.add(100*i*B+100*j*A)

dm=F//D
for i in range(dm+1):
    rs=F-i*D
    cm=rs//C
    for j in range(cm+1):
        sugar.add(i*D+j*C)
sugar=sorted(sugar)
water=sorted(water)
for s in sugar:
    for w in water:
        if w/100*E>=s and s+w<=F and s+w!=0:
            den=s/(s+w)
            if den>=density:
                density=den
                Ans1=s+w
                Ans2=s
            else:
                break
print(Ans1,Ans2)
# AtCoder
s = input()
mid = str(len(s) - 2)
print(f'{s[0]}{mid}{s[-1]}')


### FIXED CODE ###

# AtCoder
s = input()
mid = str(len(s) - 2)
print(s[0]+mid+s[-1])
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

able_to_ride = [p for p in h if h >= k]
print(len(able_to_ride))

### FIXED CODE ###

n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

able_to_ride = [p for p in h if p >= k]
print(len(able_to_ride))
from collections import deque

def bfs(grid, start):
    H, W = len(maze), len(maze[0])
    distance = [[-1] * W for _ in range(H)]
    queue = deque([start])
    distance[start[0]][start[1]] = 0
    while queue:
        x, y = queue.popleft()
 
        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            new_y, new_x = y + j, x + i
            if 0 <= new_y < W and 0 <= new_x < H:
                if grid[new_x][new_y] == '.' and distance[new_x][new_y] == -1:
                    distance[new_x][new_y] = distance[x][y] + 1
                    queue.append((new_x, new_y))
    return max(map(max, distance))

h, w = map(int, input().split())
maze = [input() for _ in range(h)]


res = -1
for i in range(h):
    for j in range(w):
        if(maze[i][j] == '#'): continue
        tmpmaze = copy.deepcopy(maze)
        steps = bfs(tmpmaze, [i, j])
        if(steps > res):
            res = steps
print(res)

### FIXED CODE ###

from collections import deque
import copy

def bfs(grid, start):
    H, W = len(grid), len(grid[0])
    distance = [[-1] * W for _ in range(H)]
    queue = deque([start])
    distance[start[0]][start[1]] = 0
    while queue:
        x, y = queue.popleft()
 
        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            new_y, new_x = y + j, x + i
            if 0 <= new_y < W and 0 <= new_x < H:
                if grid[new_x][new_y] == '.' and distance[new_x][new_y] == -1:
                    distance[new_x][new_y] = distance[x][y] + 1
                    queue.append((new_x, new_y))
    return max(map(max, distance))

h, w = map(int, input().split())
maze = [input() for _ in range(h)]


res = -1
for i in range(h):
    for j in range(w):
        if(maze[i][j] == '#'): continue
        tmpmaze = copy.deepcopy(maze)
        steps = bfs(tmpmaze, [i, j])
        if(steps > res):
            res = steps
print(res)
N, Y = map(int, input().split())

for a in range(N+1):
    for b in range(N-a+1):
        c = N-a-b
            if 10000*a+5000*b+1000*c == Y:
                print(a,b,c)
                exit()
                
print(-1,-1,-1)


### FIXED CODE ###

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

for a in range(N + 1):
    for b in range(N - a + 1):
        c = N - a - b
        if 10000*a+5000*b+1000*c == Y:
            print(a,b,c)
            exit()
                
print(-1,-1,-1)
from math import log, sqrt
max_num = 1
for i in range(2, int(sqrt(X)) + 1):
    max_num = max(max_num, i ** int(log(X, i)))

print(max_num)

### FIXED CODE ###

import math
X = int(input())

sq = int(math.sqrt(X))
m = 1
for b in range(2, sq+1):  # ここで2が1になると1のp乗となり永遠にループが回り続ける
    p = 2
    tmp = b ** p
    while tmp <= X:
        m = max(tmp, m)
        p += 1
        tmp = b ** p
print(m)
a, b= map(str, input().split())
if a=="H":
    print(b)
else:
    if b = "H":
        print("D")
    if b = "D":
        print("H")

### FIXED CODE ###

a, b= map(str, input().split())
if a=="H":
    print(b)
else:
    if b == "H":
        print("D")
    if b == "D":
        print("H")
words = input()
if words[-1] != s:
  words += "s"
else:
  words += "es"
print(words)
  
 
  


### FIXED CODE ###

words = input()
if words[-1] != "s":
  words += "s"
else:
  words += "es"
print(words)
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i + 5000*j +1000(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()
        else:
            print("-1 -1 -1")

### FIXED CODE ###

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

for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + 1000 * (n-i-j)==y:
            print(i, j, n-i-j)
            exit()
print("-1 -1 -1")
n=int(input())
print(a+a*a+a*a*a)

### FIXED CODE ###

a=int(input())
print(a+a*a+a*a*a)
n, a, b = map(int,input().split())

sum = ""
k = (n//(a+b)+1)
for i in range(k):
  blue = "b"*a
  red = "r"*b
  sum = sum + blue + red
  if len(sum) >= n:
    ans = sum[:n].count("b")
    print(ans)
    exit()
    

print(sum.count("b"))

### FIXED CODE ###

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

ans = a*(n//(a+b))+ min(a,n%(a+b))
print(ans)
S=input()
for i in range(2):
  if a[i]==a[i+1]:
    print("Bad")
    return
print("Good")

### FIXED CODE ###

S=input()
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")
import sys
row = sys.stdin.readline
 
def read_ints(row):
    return list(map(int, row().split()))
  
A ,B ,K = read_ints(row)
 
result_A = 0 if A <= K else A-K
result_B = max(B -(K-A)) if A <= K else B
print(result_A,result_B)

### FIXED CODE ###

import sys
row = sys.stdin.readline
 
def read_ints(row):
    return list(map(int, row().split()))
  
A ,B ,K = read_ints(row)
 
print(max(0, A - K),max(0, B-max(0,(K-A))))
#!/usr/bin/env python3

def main():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
        exit()
    p = set(map(int,input().split()))
    lst = set(range(1,101)) - p
    tmp = 130
    if min(lst) >= X:
        print(min(lst))
        exit()
    if max (lst) <= X:
        print(max(lst))
        exit()
    prev = min(lst)
    for s in lst:
        if abs(s - X) >= tmp:
            print(prev)
            exit()
        prev = s
        tmp = abs(s - X)
    print(max(lst))

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3

def main():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
        exit()
    p = set(map(int,input().split()))
    if N == 100:
        print(0 if X<=50 else 101)
        exit()
    lst = [0] + list(set(range(1,101)) - p) + [101]
    lst2 = [abs(lst[i] - X) for i in range(len(lst))]
    min_ = min(lst2)
    print(lst[lst2.index(min_)])    



if __name__ == '__main__':
    main()
a, b, c = map(int, input().split())
colors = set(a, b, c)
print(len(colors))

### FIXED CODE ###

numbers=list(map(int,input().split()))
colors = set(numbers)
print(len(colors))
a, b = input().split()
a, b_100 = int(a), int(b.replace('.', ''))
print(a * b // 100)


### FIXED CODE ###

a, b = input().split()
print(int(a) * round(float(b) * 100) // 100)
a = list(map(int, input().split()))
b = list(map(int, input().split()))

output = (a(0)-b(0))*(a(1)*b(1))
print output

### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print (output)
n, k  =map(int, input().split())

ans = 0
#ｋで割り切れるn以下の数のリスト
odd = [i for i in range(k, n+1, k)] #kから始まり、nまで、ｋ刻み
ans += len(odd) ** 3 #abcの選び方のため3乗

if k % 2 == 0:
  #k/2から始まり、nまでで、kで割ると余りがk/2になる
  even = [i for i in range(k//2, n+1, k)]
  ans += even
  
print(ans)


### FIXED CODE ###

n, k  =map(int, input().split())

ans = 0
#ｋで割り切れるn以下の数のリスト
odd = [i for i in range(k, n+1, k)] #kから始まり、nまで、ｋ刻み
ans += len(odd) ** 3 #abcの選び方のため3乗

if k % 2 == 0:
  #k/2から始まり、nまでで、kで割ると余りがk/2になる
  even = [i for i in range(k//2, n+1, k)]
  ans += len(even) ** 3
  
print(ans)
s = input()
print(s.replace("9","c").replace("1","9").replace("c"."1"))


### FIXED CODE ###

s = input()
print(s.replace("9","c").replace("1","9").replace("c","1"))
import re
s=input().replace("?",".")
t=input()
for i in range(len(s)-lent(t)+1):
  if re.match(s[i:i+len(t)],t):
    s=s.replace(".","a")
    print(s[:i]+t+s[i+len(t):])
    exit()
print("UNRESTORABLE")

### FIXED CODE ###

sd = input()
t = input()

n = len(sd)
m = len(t)
s = []

# sd を後ろから見ていき、 t の入りそうな場所を探す
for i in range(n - m, -1, -1):
    t_kamo = sd[i:i + m]
    for j in range(m + 1):
        # 1文字ずつ順に入りうるか調べ、最後まで入るなら "?" を "a" に置き換えて出力
        if j == m:
            print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
            exit()
        if t_kamo[j] == "?":
            continue
        elif t_kamo[j] != t[j]:
            break

print("UNRESTORABLE")
a=int(input())
b=int(input())
print(a*b,end=" ")
print((a+b)*2)

### FIXED CODE ###

a,b=[int(i) for i in input().split()]
print(a*b,end=" ")
print((a+b)*2)
a, b = map(int, input().split())
if a < 10 and b < 10:
  print a*b
else:
  print -1

### FIXED CODE ###

a, b = map(int, input().split())
if a < 10 and b < 10:
  print(a*b)
else:
  print(-1)
import numpy as np
import fractions
import sys
input = sys.stdin.readline


def f(x):
    res = 0
    while x % 2 == 0:
        x /= 2
        res += 1
    return res


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    A = np.array(A) // 2

    t = f(A[0])
    for i in range(len(A)):
        if f(A[i]) != t:
            print(0)
            return 0
        A[i] >>= t
    M >>= t

    l = 1
    for i in range(N):
        l = lcm(l, A[i])
        if l > M:
            print(0)
            return 0

    M /= l
    ans = (M + 1) // 2
    print(int(ans))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import fractions
import sys
input = sys.stdin.readline


def f(x):
    res = 0
    while x % 2 == 0:
        x /= 2
        res += 1
    return res


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    A = list(map(lambda x: x // 2, A))

    t = f(A[0])
    for i in range(len(A)):
        if f(A[i]) != t:
            print(0)
            return 0
        A[i] >>= t
    M >>= t

    l = 1
    for i in range(N):
        l = lcm(l, A[i])
        if l > M:
            print(0)
            return 0

    M /= l
    ans = (M + 1) // 2
    print(int(ans))


if __name__ == "__main__":
    main()
n = input()
print((n // 2) + (n % 2))

### FIXED CODE ###

n = int(input())
print((n // 2) + (n % 2) )
N = int(input().rstrip())
A = [int(s) for s in input().rstrip().split()]
A.sort()

squared = [2]
tmp = 2
while tmp < 2 * 10**9:
    tmp *= 2
    squared.append(tmp)

pairs = []
for i in range(N):
    for j in range(i+1, N):
        if A[i] + A[j] in squared:
            pairs.append([A[i], A[j]])

adopt = [format(i, 'b').rjust(len(pairs), '0') for i in range(2**len(pairs))]
max_pair = 0

for i in range(len(adopt)):
    num = []
    for j in range(len(pairs)):
        if adopt[i][j] == '1':
            num.append(pairs[j][0])
            num.append(pairs[j][1])
    if len(num) == len(set(num)) and len(num) > max_pair:
        max_pair = len(num)

print(max_pair // 2)

### FIXED CODE ###

state = input().rstrip()
ans = 0
cnt = 0
for i, s in enumerate(state):
    if s == 'B':
        cnt += 1
    else:
        ans += cnt
print(ans)
n=int(input())

l=list(map(int,input().split()))
cnt=0
for i in range(n):
	if l[i]==cnt+1:
      cnt+=1
      
if cnt==0:
  	print(-1)
else:
  print(n-cnt)
  

     
      
      

### FIXED CODE ###

n=int(input())
 
l=list(map(int,input().split()))
cnt=0
for i in range(n):
	if l[i]==cnt+1:
	    cnt+=1
      
if cnt==0:
  	print(-1)
else:
  print(n-cnt)
import sys
 
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
 
sc.sort()
ans = 0
d = 0
s = 0
 
if n != 1 and sc[0][0] == 1 and sc[0][1] == 0:
  print('-1')
  sys.exit()

if n != 1 and sc[0][0] != 1:
  ans += 10**(n-1)
 
for i in sc:
  if i[0] != d:
    d = i[0]
    s = i[1]
    ans += s * (10 ** (n-d))
  else:
    if i[1] != s:
      print('-1')
      sys.exit()
 
print(ans)

### FIXED CODE ###

import sys

n,m = map(int, input().split())

num = ['-'] * n

for i in range (m):
  s,c = map(int, input().split())
  if num[s-1] != '-' and num[s-1] != c:
    print('-1')
    sys.exit()
  else:
    num[s-1] = c

if n > 1:
  if num[0] == 0:
    print('-1')
    sys.exit()
  elif num[0] == '-':
    num[0] = 1 
  
for i in range(n):
  if num[i] == '-':
    num[i] = '0'
  else:
    num[i] = str(num[i])

print(''.join(num))
# # -*- coding: utf-8 -*-
N=int(input())
X=[]
Y=[]
for _ in range(N):
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
Z=[]
for i in range(N):
    for j in range(i+1,N):
        Z=Z+[(abs(X[i]-X[j]),abs(Y[i]-Y[j]))]
import collections
z=collections.Counter(Z)
print(N-z.most_common()[0][1])

### FIXED CODE ###

# -*- coding: utf-8 -*-
n=int(input())
x=[]
y=[]
total=[]
count=[]
for _ in range(n):
    x1,y1=map(int,input().split())
    x.append(x1)
    y.append(y1)
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        else:
            temporary=(x[i]-x[j],y[i]-y[j])
            if temporary in total:
                count[total.index(temporary)]=count[total.index(temporary)]+1
            else:
                total.append(temporary)
                count.append(0)
if n==1:
    print(1)
else:
    print(n-max(count)-1)