peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from itertools import permutations
import math
n = int(input())
x = []
y = []
for i in range(n):
    xi, yi = map(int, input().split(' '))
    x.append(xi)
    y.append(yi)

l = [i for i in range(n)]
route = list(permutations(l))
length = 0
for ls in route:
    for i in range(n-1):
        length += math.sqrt((x[ls[i+1]]-x[ls[i]])**2+(y[ls[i+1]]-y[ls[i]])**2)
ans = length/math.factorial(n)
print(ans)
# Judge status: Accepted
from collections import defaultdict
counter = defaultdict(int)
for _ in range(int(input())):
    counter[input()] += 1
for _ in range(int(input())):
    counter[input()] -= 1
print(max(0, max(counter.values())))
# Judge status: Accepted
# -*- coding: utf-8 -*-

import numpy as np
S=int(input())

MOD=10**9+7

D=[0]*(S+1)
D[0]=1

L=0
for i in range(3,S+1):
    L+=D[i-3]
    D[i]=L
    D[i]%=MOD

ans=D[S]

print(int(ans))
# Judge status: Accepted
a, b = map(int, input().split())
res = (a + b + 2 - 1) // 2
print(res)
# Judge status: Accepted
from math import ceil
n, a, b, c, d, e = [int(input()) for _ in range(6)]
neck = min(a, b, c, d, e)
ans = ceil(n / neck) + 4
print(int(ans))
# Judge status: Accepted
print('ABC' if int(input()) <= 999 else 'ABD')
# Judge status: Accepted
import numpy as np
A = np.array([list(map(int, input().split())) for i in range(3)])
N = int(input())
for i in range(N):
    bingo_num = int(input())
    A = np.where(A == bingo_num, 0, A)
if (0 in np.sum(A, axis=1)
    or 0 in np.sum(A, axis=0)
    or np.sum(np.diag(A)) == 0
        or A[0, 2]+A[1, 1]+A[2, 0] == 0):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x=int(input())
import math
def is_prime(n):
    if n<=1:
        return False
    for i in range(2,int(math.sqrt(n) + 1)):
        if n%i == 0:
            return False
    return True
for i in range(x,2*x+1):
        if is_prime(i):
                print(i)
                exit()
# Judge status: Accepted
A, B = map(int, input().split())
S = input()
print("Yes" if S[A] == "-" and S.count("-") == 1 else "No")
# Judge status: Accepted
import sys
import math

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b, x = map(int, input().split())
    s = a * (x / pow(a, 2))

    if (a * b) // 2 >= s:
        l = s * 2 / b
        res = math.degrees(math.atan(b / l))
        print(res)
    else:
        l = (a * b - s) * 2 / a
        res = math.degrees(math.atan(l / a))
        print(res)


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
X = int(input())
if X>=30:
  print('yes')
else:
  print('No')
# Judge status: Accepted
import numpy as np

n = int(input())

a = list(map(int, input().split()))
a = np.array(a)
a -= np.array(range(1,n+1))

b = np.median(a)

ans = int(np.sum(abs(a-b)))

print(ans)
# Judge status: Accepted
n, m = map(int,input().split())
ps = list(list(map(str,input().split())) for _ in range(m))

check = [True] * (n+1)
wa = [0] * (n+1)
wa_ans = 0
for i in range(m):
    if ps[i][1] == 'AC' and check[int(ps[i][0])]:
        check[int(ps[i][0])] = False
        wa_ans += wa[int(ps[i][0])]
    if ps[i][1] == 'WA':
        wa[int(ps[i][0])] += 1
ans = 0
for i in check:
    if not i:
        ans += 1

print(ans,wa_ans)
# Judge status: Accepted
s = list(input())
t = list(input())

ans = "No"
for i in range(len(s)):
    s0 = s[0]
    s.remove(s0)
    s.append(s0)
    if s == t:
        ans = "Yes"
        break

print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int, input().split()))

    scarf_0 = 0
    for a in A[1:]:
        scarf_0 ^= a
    
    scarf_all = scarf_0 ^ A[0]
    
    ans = [scarf_all^a for a in A]
    
    print(*ans, sep=" ")

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7

ans = 0
for keta in range(61):
    now = 0
    for x in a:
        if x & (1 << keta):
            now += 1
    ans += (now*(n-now))*2**keta
    ans %= mod

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
l = []

for i in range(m):
    a, b = map(int, input().split())
    l.append(a)
    l.append(b)

for i in range(1, n + 1):
    print(l.count(i))
# Judge status: Wrong Answer
s= int(input())
L0 = 2
L1 = 1
L = 0
if s ==1:
  print(L)
else:
  for i in range(2,s+1):
    L = L0 + L1
    L0 = L1
    L1 = L
print(L)
# Judge status: Wrong Answer
n=int(input())
l=360//n
print(l)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a+b>c:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
def main():
    n = int(input())
    word_lst = [""] * n
    previous_word = input()
    ok = True
    for i in range(1,n):
        now_word = input()
        if not (now_word[0] == previous_word[-1]):
            ok = False
            break
        word_lst.append(now_word)
        previous_word = now_word
    if len(word_lst) != len(set(word_lst)):
        ok = False

    print("Yes" if ok else "No")






if __name__ == '__main__':
    main()
# Judge status: Accepted
S = list(input())
N = len(S)
S_mae = S[:int((N-1)/2)]
S_usi = S[int((N+1)/2):]

if S_mae == S_mae[::-1] and S_usi == S_usi[::-1] and S == S[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
w = list(input())
ans = "Yes"

for i in w:
    cnt = 0
    for j in w:
        if i == j:
            cnt += 1
    if cnt%2 == 1:
        ans = "No"
        break

print(ans)
# Judge status: Accepted
s = input()
l = len(s)
ans = 0
for i in range(2**(l-1)):
    e = ""
    for j in range(l):
        if ((i >> j) & 1):
            e += s[j] + "+"
        else:
            e += s[j] + "-"
    if eval(e[:-1]) == 7:
        print(e[:-1]+'=7')
        break
# Judge status: Accepted
r = int(input())
print(r* 2 * 3.1415)
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

if x>=y:
    print(min(a*x+b*y, c*x*2, c*y*2+a*(x-y)))
elif x<y:
    print(min(a*x+b*y, c*y*2, c*x*2+b*(y-x)))
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in range(1, n):
    ans = (ans + v[i]) / 2
print(ans)
# Judge status: Wrong Answer
from collections import Counter

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

d = Counter(A)

tmp = []
for k, v in d.items():
    if v >= 2:
        tmp.append(k)

if len(tmp) >= 2:
    print(tmp[-1]*tmp[-2])
else:
    print(0)
# Judge status: Wrong Answer
import math
N = int(input())
print((math.factorial(N)) % 10 ** 9 + 7)
# Judge status: Accepted
N,M = map(int,input().split())
AB = [[] for _ in range(N)]
ans = [0]*N
for _ in range(M):
  a,b = map(int,input().split())
  AB[a-1].append(b-1)
  AB[b-1].append(a-1)

from collections import deque

node = 0
q = deque([0])

check = [0]*N
check[0] = 1
while len(q) > 0:
  node = q.popleft()
  for i in AB[node]:
    if check[i] == 0:
      q.append(i)
      check[i] = 1
      ans[i] = node
print("Yes")
for i in range(1,N):
  print(ans[i]+1)
# Judge status: Accepted
d = int(input())
t = 0 
while True:
  if t*(t+1)//2 >=d:
    print(t)
    exit()
  t +=1
# Judge status: Accepted
a,b,c = input().split("/")
A = a + b + c
if A <= "20190430" :
    print("Heisei")
else :
    print("TBD")
# Judge status: Accepted
A, B, C, D = map(int, input().split())

lower = max(A,C)
upper = min(B,D)

if lower<=upper:
    print(upper-lower)
else:
    print(0)
# Judge status: Accepted
A, B, C, K = map(int, input().split())

if K <= A:
    print(K)
elif A < K <= A + B:
    print(A)
else:
    print(A - (K - A - B))
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]

d = [0] * (10**5)

for i in range(n):
    d[a[i]] += 1

ans = 1

for j in range(1, n-1):
    ans = max(ans, d[j-1] + d[j] + d[j+1])

print(ans)
# Judge status: Accepted
N = int(input())
A = int(input())
if N % 500 <= A:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a = list(map(int,input().split()))
a.sort()
b = a[2] - a[1]
c = a[2] - a[0]
ans = 0
 
ans += b
 
if (c-b) % 2 == 0:
    ans += (c-b)//2
elif (c-b) % 2 == 1:
    ans += (c-b)//2 + 2
 
print(ans)
# Judge status: Accepted
# coding: utf-8


target = int(input())

total = 0
for i in range(1, target+1):
    total += i
    if total >= target:
        print(i)
        break
# Judge status: Accepted
W, a, b = map(int, input().split())
if a+W<b:
    print(b-a-W)
elif b+W<a:
    print(a-W-b)
else:
    print(0)
# Judge status: Accepted
C = input()
print(chr(ord(C)+1))
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import sys

def main():
  alist = [
    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
    "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
    "u", "v", "w", "x", "y", "z",
  ]

  input = sys.stdin.readline()
  #print(input)
  
  i = 0
  for a in alist:
    if input == a:
      print(alist[i+1])
    i += 1

if __name__ == '__main__':
  main()
# Judge status: Accepted
n, k = map(int, input().split())
mod = 10**9+7

ans = 0
for i in range(k, n+2):
    mini = i*(i-1)//2
    maxi = (2*n+1-i)*i//2
    ans = (ans + maxi-mini+1) % mod

print(ans)
# Judge status: Accepted
H =int(input())
c = 0
while H:
    H = H >> 1
    c += 1
print(2**c-1)
# Judge status: Wrong Answer
# C - いっしょ
def main():
    import math
    n = int(input())
    a = list(map(int, input().split()))
    p = math.ceil(sum(a)/n)
    cnt = 0

    for i in range(n):
        cnt += (a[i]-p)**2
    else:
        print(cnt)
    
if __name__ ==  "__main__":
    main()
# Judge status: Accepted
from math import floor

def main():
    a,b,n = (int(x) for x in input().split())
    if b <= n:
        ans = floor(a*(b-1)/b)
    else:
        ans = floor(a*(n)/b)
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S=input()
for i in range(len(S)-2):
    if i==0:
        a=abs(int(S[i:i+2])-753)
    else:
        if a>abs(int(S[i:i+3])-753):
            a=abs(int(S[i:i+3])-753)
    
print(a)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = sum(A[::2]) - sum(A[1::2])
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

d = {}
ans = 0

for i in a:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1

for k,v in d.items():
    if k <= v:
        ans += v-k
    else:
        ans += v

print(ans)
# Judge status: Accepted
s = input()
print(s.replace("2017", "2018"))
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int,input().split())) for _ in range(m)]

bc = sorted(bc, reverse=True, key=lambda x: x[1])
a.sort()
num = 0

for i in range(m):
    b, c = bc[i]
    while b>0:
        if num == n:
            break
        if a[num]<c:
            a[num] = c
            b -= 1
            num += 1
        else:
            break

print(sum(a))
# Judge status: Accepted
n=int(input())
s=input()
s=s

ll=0 #左側の黒い数を保持
rr=s.count(".") #右側の白い数を保持

result=ll+rr
for item in s:
    if item=="#":
        ll+=1
    else:
        rr-=1
    
    result=min(result,ll+rr)

print(result)
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))

min = P[0]
ans = 0

for i in range(N):
    if i == 0:
        ans += 1
    elif min > P[i]:
        ans += 1
        min = P[i]

print(ans)
# Judge status: Accepted
S="012 345 678 036 147 258 048 246 "
A=[input().split()for i in range(3)]
B=A[0]+A[1]+A[2]
for b in [input()for i in range(int(input()))]:
  for l in range(9):
    S=S.replace(str([9,l][b==B[l]]),"")
print(["No","Yes"][S.find("  ")>-1])
# Judge status: Accepted
n = int(input())
arr = list(map(int, input().split()))
count = 0
for i in range(1, len(arr)-1):
  if (arr[i+1] - arr[i])* (arr[i] - arr[i-1]) > 0:
    count += 1
print(count)
# Judge status: Wrong Answer
# input
N = int(input())
B = list(map(int, input().split()))

# check
A = []
append = A.append
for i, b in enumerate(B):
    while len(A[i:]) < 2:
        if i < len(B) - 1 and b >= B[i + 1]:
            append(B[i + 1])
        else:
            append(b)

print(sum(A))
# Judge status: Accepted
import numpy as np


n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(list(input()[:]))
b = []
for i in range(m):
    b.append(list(input()[:]))
a = np.array(a)
b = np.array(b)
for i in range(n-m+1):
    for j in range(n-m+1):
        if (a[i:i+m, j:j+m] == b).all():
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")
# Judge status: Accepted
#TODO
def dfs(word, idx):
    if len(word)==n:
        print(word)
        return
    for j in range(idx):
        dfs(word+chr(j+mx), idx)
    dfs(word+chr(idx+mx), idx+1)

n = int(input())
mx = ord('a')
dfs("", 0)
# Judge status: Accepted
U=input()
B=input()

if U[0]==B[2] and U[2]==B[0] and U[1]==B[1]:
	print("YES")
else:
	print("NO")
# Judge status: Accepted
# A - 500 Yen Coins
k,x=list(map(int,input().split()))
if (k*500)>=x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
# 答え用の配列を準備しておく
ans = [0 for i in range(n+1)]
for x in range(1,int(n**0.5+1)):
    for y in range(1,int(n**0.5+1)):
        for z in range(1,int(n**0.5+1)):
            res = x**2+y**2+z**2+x*y+y*z+x*z
            # resの値がn以下ならカウントする
            if res<=n:
                ans[res] += 1
for i in range(1,n+1):
    print(ans[i])
# Judge status: Accepted
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
ans=0
flag=0
for i in range(n):
    d1,d2=get_ints()
    if d1==d2:
        ans=ans+1
        if ans>=3:
            flag=1
    else:
        ans=0
if flag==1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# coding:utf-8

H, N = map(int, input().split(' '))
ab_list = []
for _ in range(N):
    a, b = map(int, input().split(' '))
    ab_list.append([a, b])
dp = [0] * (H + 1)

for i in range(1, H + 1):
    for j in range(N):
        if ab_list[j][0] <= i:
            dp[i] = dp[i - ab_list[j][0]] + ab_list[j][1]
        else:
            dp[i] = ab_list[j][1]

print(dp[H])
# Judge status: Wrong Answer
a = list(map(int, input().split()))
print('bust' if sum(a) >= 22 else 'Win')
# Judge status: Wrong Answer
N, K = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
sorted_lst = sorted(lst, key=lambda x: x[1])
cnt = 0
for i in lst:
  cnt += i[1]
  if (cnt >= K):
    print(i[0])
    break
# Judge status: Accepted
from collections import Counter
n=int(input())
a=Counter(list(map(int, input().split())))
ans=0
for i,j in a.items():
  if i>j:
    ans+=j
  elif i<j:
    ans+=j-i
print(ans)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())

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

minus_cnt = 0
for i in range(N):
    if A[i] < 0:
        minus_cnt += 1

ans = 0
min_val = 10**10
if minus_cnt % 2 == 0:
    for i in range(N):
        ans += abs(A[i])
else:
    for i in range(N):
        ans += abs(A[i])
        min_val = min(min_val, abs(A[i]))
    ans -= min_val * 2

print(ans)
# Judge status: Accepted
A, B, K = map(int, input().split())
divisors = []

for i in range(min(A,B), 0, -1):
    if A%i == B%i == 0:
        divisors.append(i)

print(divisors[K-1])
# Judge status: Accepted
from itertools import permutations

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))


l = []
for pp in permutations(range(1,n+1)):
	l.append(list(pp))

a = l.index(p)
b = l.index(q)
print(abs(a - b))
# Judge status: Wrong Answer
tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()

if S == U:
  print(str(A-1) + " " + str(B))
else:
  print(str(B) + " " + str(A))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

result_list = [0] * N
for i, v in enumerate(A):
    result_list[v - 1] = i + 1

result = ''
for i in result_list:
    result += str(i)
    
print(' '.join(result))
# Judge status: Accepted
#conding utf-8
A=[int(input()) for i in range(5)]
B=[0 for i in range(5)]
C=[0 for i in range(5)]

tmp=10
m=0
for i in range(5):
  if A[i]%10 !=0:
    if A[i]%10<tmp:
      m=i
      tmp=A[i]%10

for i in range(5):
  if A[i]%10 !=0:
    if i != m:
      B[i]=int(A[i]/10)*10+10
    else:
      B[i]=A[i]
  else:
    B[i]=A[i]

print(sum(B))
# Judge status: Accepted
N = int(input())
S = str(input())

ans = 0
for i in range(N):
    same = 0
    S_a = S[0:i+1]
    S_b = S[i+1:N]
    for alphabet in "abcdefghijklmnopqrstuvwxyz":
        if S_a.count(alphabet) >0 and S_b.count(alphabet):
            same +=1
    if same > ans:
        ans = same
print(ans)
# Judge status: Accepted
#
x = int(input())
num_1 = x // 500
num_2 = (x - num_1 * 500) // 5

ans = num_1 * 1000 + num_2 * 5
print(ans)
# Judge status: Accepted
def main():
  n, *a = map(int, open(0).read().split())
  b=[None]*n
  i=1
  for index in a:
    b[index-1]=i
    i+=1
  print(" ".join(map(str,b)))
if __name__=="__main__":
  main()
# Judge status: Wrong Answer
import decimal
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)

ans = t[0]

for i in t[1:]:
    gcd = math.gcd(ans, i)
    ans = int(decimal.Decimal(decimal.Decimal(
        ans) * decimal.Decimal(i)) / decimal.Decimal(gcd))
print(ans)
# Judge status: Wrong Answer
import numpy as np
import fractions as f
from functools import reduce

n,m=map(int,input().split())
a=np.array(list(map(int,input().split())))
a=a//2
def lcm(x,y):
    return (x*y)//f.gcd(x,y)
def lcm_list(num):
    return reduce(lcm,num,1)
l=lcm_list(a)
if l%2==0:
    ans=0
else:
    ans=m//l

#奇数を取り除く
if ans%2==0:
    ans//=2
else:
    ans=ans//2+1
print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
if A%2 == B%2 == C%2 == 1:
    print(min(A*B, B*C, A*C))
else:
    print(0)
# Judge status: Accepted
o, e = input(), input()
op = ""
for i in range(len(e)): op += o[i] + e[i]
print(op if len(e) == len(o) else op+o[-1])
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
x = [int(x) for x in input().split()]

ans = 10**15
for i in range(N-K+1) :
    if x[i]*x[i+K-1] >= 0 :
        temp = max(abs(x[i]), abs(x[i+K-1]))
    elif abs(x[i]) > x[i+K-1] :
        temp = abs(x[i]) + 2*x[i+K-1]
    else :
        temp = x[i+K-1] + 2*abs(x[i])
    ans = min(ans, temp)

print(ans)
# Judge status: Accepted
S = list(input())

print(2*min(S.count("1"),S.count("0")))
# Judge status: Accepted
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 = int(input())
A = list(map(int, input().split()))

acc =[0] * (n + 1)
for i in range(1, n + 1):
    acc[i] = acc[i - 1] + A[i - 1]

ans = INF
for i in range(1, n):
    now = abs(acc[i] - acc[0] - (acc[n] - acc[i]))
    ans = min(ans, now)
print(ans)
# Judge status: Accepted
n=int(input())
count=0
counts=[]
z=[]
for i in range(n):
	x,y=list(map(int,input().split()))
	z.append([x,y])
z.append([-14,-20])
for i in z:
	if i[0]==i[1]:
		count+=1
	else:
		counts.append(count)
		count=0
if max(counts)>=3:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
n = int(input())-1
ans = 0
for i in range(n):
    b = n//(i+1)
    ans += b
print(ans)
# Judge status: Accepted
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

s = list(input())
t = input()
for i in range(len(s)):
    ans = ""
    cnt = 0
    for j in range(-1,len(s)-1):
        ans += s[j]
    res = ""
    for j in range(len(s)):
        s[j] = ans[j]
        res += s[j]
    if res == t:
        print("Yes")
        sys.exit()
print("No")
# Judge status: Accepted
n, x = map(int, input().split())
a = [int(i) for i in input().split()]
op = 0
for i in range(1, n):
    s = a[i-1] + a[i]
    if s > x:
        op += s - x
        if a[i] < s - x:
            a[i] = 0
        else:
            a[i] -= s - x
print(op)
# Judge status: Accepted
N,K,S = map(int,input().split())

if S != 10**9:
    ans = [S]*K + [S+1]*(N-K)
else:
    ans = [S]*K + [S-1]*(N-K)

print(*ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
print("Yes" if a <= c <= b else "No")
# Judge status: Accepted
n = int(input())
L = list(map(int,input().split()))
L4 = [x%4 == 0 for x in L]
L2 = [(x%2 == 0 and x%4 != 0) for x in L]
#print(sum(L2),sum(L4))
other = len(L) - sum(L2) - sum(L4)
if sum(L2) == 0:
    if other <= sum(L4)+1:
        print("Yes")
    else:
        print("No")
else:        
    if other <= sum(L4):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
C=input()+input()
print("YNEOS"[C!=C[::-1]::2])
# Judge status: Accepted
n = int(input())
now = 0
for i in range(1,n+2):
    now += i
    if now >= n:
        x = now-n
        for j in range(1,i+1):
            if j != x:
                print(j)
        exit()
# Judge status: Wrong Answer
n, x = map(int,input().split())
A = list(map(int,input().split()))
sum = []
ans = 0
for i in range(n-1):
    sum.append(A[i]+A[i+1])
for j in range(n-1):
    if j != n-2:
        if sum[j] > x:
            diff = sum[j]-x
            sum[j] -= diff
            sum[j+1] -= diff
            ans += diff
    else:
        if sum[j] > x:
            diff = sum[j]-x
            sum[j] -= diff
            ans += diff

print(ans)
# Judge status: Accepted
x, y  = list(map(int, input().split()))


if (2 * x <= y <= 4 * x) and y % 2 == 0:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
from bisect import bisect_left, bisect_right
n,q=map(int,input().split())
s=list(input())
actable=[]
for i in range(len(s)-1):
    if s[i]=="A":
        if s[i+1]=="C":
            actable.append(i+1)
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    ans=bisect_left(actable,r)-bisect_left(actable,l)
    print(ans)
# Judge status: Accepted
ma = lambda :map(int,input().split())
x,n = ma()
P = list(ma())
import collections
co = collections.Counter(P)
mi = -1
ab = 10**9
for i in range(-1,102):
    if abs(x-i) <ab:
        if co[i] >0:
            continue
        ab = abs(x-i)
        mi = i
print(mi)
# Judge status: Wrong Answer
N,X,Y = map(int,(input().split()))
lList = [ 0 for i in range(N) ]
for i in range(N):
  for j in range(i + 1,N):
    l1 = j - i
    l2 = abs(X - 1 - i) + abs(Y - 1 - j)  + 1
    l = min(l1,l2)
    lList[l] += 1
    print(l,i+1,j+1)
    
for i in lList[1:]:
  print(i)
# Judge status: Accepted
N, A, B = map(int, input().split())

def digit_sum(n):
  res = 0
  while n:
    res += n % 10
    n //= 10
  return res

answer = 0
for i in range(1, N + 1):
  if A <= digit_sum(i) <= B:
    answer += i
    
print(answer)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(N-1):
    if A[i+1] > A[i]:
        stock = money // A[i]
        money = money % A[i]
        money += stock * A[i+1]
print(money)
# Judge status: Accepted
l,r,d = list(map(int, input().split(' ')))

ans = 0
for i in range(l,r+1):
    if (i % d) == 0:
        ans+=1
print(ans)
# Judge status: Accepted
inf = 10**9

def main():
  N = int(input())
  h = list(map(int,input().split()))
  memo = [inf]*N
  memo[0] = 0
  
  def calcCost(start,goal,h):
    return abs(h[goal]-h[start])
  
  for i in range(1,N):
    memo[i] = min(memo[i],memo[i-1]+calcCost(i-1,i,h))
    if i > 1:
      memo[i] = min(memo[i],memo[i-2]+calcCost(i-2,i,h))
  print(memo[-1])

main()