Harryxun/stf_run huggingface dataset:
n = input()
kakeru = map(int,input().split())
kakekake = kakeru[0]
    if n > 2:
        for i in range(2,n+1):
            kakekake = kakekake * kakeru[i-1]
    elif n==2:
    kakekake = kakeru[0] * kakeru[1]
if kakekake > 10**18:
    print(-1)
print(kakekake)

### FIXED CODE ###

n = int(input())
b = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        b *= a[i]
        if b > 10**18:
            print(-1)
            break
    if b <=10**18:
        print(b)
N, M = map(int,input().split())
tree = {}

for i in range(M):
    a, b, c = map(int, input().split())
    v= tree.get(a,[])
    v.append([b, c])
    tree[a] = v

def has_loop(tree):
    pass

m = []
def cost(v, c, visited):
    if v in visited:
        print('inf')
        exit()
    global m
    b = tree[v]
    if len(b) == 1 and tree.get(b[0][0],None) == None:
        j = c+b[0][1]
        m.append(j)
    else:
        for b, c2 in b: 
            cost(b, c+c2, visited + [v])

if has_loop(tree):
    print('inf')
    exit()

cost(1, 0, [])
print(max(m))


### FIXED CODE ###

N, M = map(int,input().split())
dist = [0] + [float('inf')] * (N - 1)

a = []
b = []
c = []

for i in range(M):
    i,j,k = map(int,input().split())
    a.append(i)
    b.append(j)
    c.append(-1*k)

INF = float('inf')

for i in range(N-1):
    for j in range(M):
        if dist[a[j] - 1] == INF: continue
        if dist[b[j] - 1] > dist[a[j] - 1] + c[j]:
            dist[b[j] - 1] = dist[a[j] - 1] + c[j]
        
ans = dist[N -1]

negative = [False] * N

for i in range(N):
    for j in range(M):
        if dist[a[j] - 1] == INF: continue
        if dist[b[j] - 1] > dist[a[j] - 1] + c[j]:
            dist[b[j] - 1] = dist[a[j] - 1] + c[j]
            negative[b[j] - 1] = True

        if negative[a[j] - 1] == True:
            negative[b[j] - 1] = True

if negative[N - 1]:
    print('inf')
else:
    print(-1 * ans)
A,B,C,X,Y=map(int,input().split)
a=A*X+B*Y
b=max(X,Y)*C*2
p=B if X<Y else A
c=min(X,Y)*2*C+abs(X-Y)*p
print(min(a,b,c))

### FIXED CODE ###

A,B,C,X,Y = map(int, (input().split()))

if C*2 >= A+B:
    print(A*X+B*Y)
else:
    if X > Y:
        ans=Y*2*C+(X-Y)*A
        ans=min(ans, X*2*C)
    else:
        ans=X*2*C+(Y-X)*B
        ans=min(ans, C*2*Y)
    print(ans)
L. R = map(int, input().split())
a = []
b = []
flag = False
if R - L >= 2019:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1, R+1):
            mod = (i*j)%2019
            if mod != 1:
                 a.append(mod)
            else:
                flag = True
                break
        if flag:
            break
        else:
            b.append(min(a))
    if flag:
        print(1)
    else:
        print(min(b))

### FIXED CODE ###

l, r = map(int, input().split())
m = []
if r-l >= 2018:
  print(0)
else:
  L = l%2019
  R = r%2019
  if L == 0 or R == 0:
    print(0)
  elif L>R:
    print(0)
  else:
    for i in range(L, R+1):
      for j in range(i+1, R+1):
        m.append(i*j%2019)
    print(min(m))
N, K = map(int, input().split())
items = []
neta = {}
for _ in range(N):
    t, d = tuple(map(int, input().split()))
    items.append((t, d))

    if t not in neta:
        neta[t] = d
    else:
        tmp = neta[t]
        if d > tmp:
            neta[t] = d

neta = sorted(neta.items(), key=lambda x: -x[1])
items = sorted(items, key=lambda x: -x[1])

ans1 = 0
select1 = set()
for i in range(K):
    t, d = items[i]
    select1.add(t)
    ans1 += d
ans1 += len(select1) ** 2

ans2 = 0
i = 1
select2 = set()
cnt = 0
for k, v in neta:
    cnt += 1
    if v + cnt ** 2 - (cnt - 1) ** 2 < items[i][0]:
        ans2 += items[i][0]
        cnt += 1
    else:
        select2.add(k)
        ans2 += v
    if cnt == K:
        ans2 += cnt ** 2
        print(max(ans1, ans2))
        exit()
ans2 += cnt ** 2

remain = K - cnt
sel = set()
i += 1
while remain != 0:
    t, d = items[i]
    if t not in sel:
        i += 1
        sel.add(t)

    else:
        ans2 += d
        sel.add(t)
        remain -= 1
        i += 1
print(max(ans1, ans2))


### FIXED CODE ###

N, K = map(int, input().split())
umai = {}
mazui = []
for _ in range(N):
    t, d = map(int, input().split())
    if t not in umai:
        umai[t] = d
    else:
        tmp = umai[t]
        if tmp < d:
            umai[t] = d
            mazui.append((t, tmp))
        else:
            mazui.append((t, d))

umai = sorted(umai.items(), key=lambda x: -x[1])
mazui = sorted(mazui, key=lambda x: -x[1])


umai_len = len(umai)
mazui_len = len(mazui)

acc_umai = [0 for _ in range(umai_len)]
acc_umai[0] = umai[0][1]
for i in range(umai_len - 1):
    acc_umai[i + 1] = acc_umai[i] + umai[i + 1][1]

acc_mazui = [0 for _ in range(mazui_len)]
if mazui_len > 0:

    acc_mazui[0] = mazui[0][1]
    for i in range(mazui_len - 1):
        acc_mazui[i + 1] = acc_mazui[i] + mazui[i + 1][1]
acc_mazui.insert(0, 0)

ans = []
for i in range(1, K + 1):
    if umai_len < i or mazui_len < K - i:
        continue
    ans.append(acc_umai[i - 1] + acc_mazui[K - i] + i ** 2)
print(max(ans))
def div(N):
    ans = []
    for i in range(1, int(N ** 0.5) + 1):
        if N % i == 0:
            ans.append(i)
            if N // i != i:
                ans.append(N // i)
    ans.sort()
    return ans
import math

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

g=math.gcd(A,B)

if g==1:
    print(1)
    exit()
cnt=0
for i in range(2,g+1):
    if g%i==0:
        cnt+=1
        g=g//i
        while g%i==0:
            g=g//i
print(cnt+1)





### FIXED CODE ###

def div(N):
    ans = []
    for i in range(1, int(N ** 0.5) + 1):
        if N % i == 0:
            ans.append(i)
            if N // i != i:
                ans.append(N // i)
    ans.sort()
    return ans
import fractions

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

g=fractions.gcd(A,B)

if g==1:
    print(1)
    exit()
cnt=0
di=div(g)

for i in di:
    f=True
    for j in range(2,int(i**0.5)+1):
        if i%j==0:
            f=False
            break
    if f:
        cnt+=1
print(cnt)
import math
N=int(input())
N=math.factorial(N)
r=math.sqrt(N)
count=0
if r%1==0:
  count-=1
for i in range(int(r)):
  if N%(1+i)==0:
    count+=2
print(count%(10**9+7))

### FIXED CODE ###

N=int(input())
R=[0]*(N-1)
for i in range(1,N+1):
  for r in range (2,N+1):
    count=0
    while i%r==0:
      i=i/r
      count+=1
    R[r-2]+=count

count=1
for r in range(N-1):
  count=count*(R[r]+1)
print(count%(10**9+7))
while True:
    m, f, r = map(int, input().split())
    if m = f = r == -1:
        break:
    elif (m == -1 or f == -1) or m+f < 30:
        print(F)
    elif m + f >= 80:
        print(A)
    elif 65 <= m + f < 80:
        print(B)
    elif 50 <= m + f < 65:
        print(C)
    elif 30 <= m + F < 50:
        if r >= 50:
            print(C)
        else:
            print(D)
    else:
        print(F)


### FIXED CODE ###

while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif (m == -1 or f == -1) or m+f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        print('C')
    elif 30 <= m + f < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')
U = int(input())
b = str(U)
c = int(b[-1])
if c in [2,4,5,7,9]:
    print("hon")
elif c in [0,1,6,8]:
    print("pon")
else:
    print("bon")S

### FIXED CODE ###

a = int(input())
b = str(a)
c = int(b[-1])
if c in [2,4,5,7,9]:
    print("hon")
elif c in [0,1,6,8]:
    print("pon")
else:
    print("bon")
import math

N_str = input()
N = int(N_str)
digit = int(math.log10(N))+1

digit = len(N_str)

memo = [0]*26
for i in range(26):
    memo[i] = 5**(i+1)

if N % 2 == 0:
    ans = 0
    for j in range(26):
        ans += (N//memo[j])//2
    print(ans)
else:
    print(0)

### FIXED CODE ###

import math

N = int(input())

memo = [0]*26
for i in range(26):
    memo[i] = 5**(i+1)

if N % 2 == 0:
    ans = 0
    for j in range(26):
        ans += (N//memo[j])//2
    print(ans)
else:
    print(0)
c=0
n=int(input())
A_list=input().split()
B_list=input().split()
C_list=input().split()
for i in range(0,n):
  c+=B_list[A_list[i]-1]
  if i==n:
    break
  if A_list[i]==(A_list[i+1]-1):
    c+=C_list[A_list[i+1]-1]
print(c)    
  

### FIXED CODE ###

c=0
n=int(input())
A_list=list(map(int,input().split()))
B_list=list(map(int,input().split()))
C_list=list(map(int,input().split()))
for i in range(0,n):
  c+=B_list[A_list[i]-1]
  if i==n-1:
    break
  if A_list[i]==(A_list[i+1]-1):
    c+=C_list[A_list[i]-1]
print(c)
a, b = map(int, input().split(" "))

if (a%3 ==0) or (b%3 ==0) or ((a+b)%3 ==0)):
    print("Possible")
else:
    print("Impossible")

### FIXED CODE ###

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

if (a+b)%3 == 0:
    print("Possible")
elif a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
else:
    print("Impossible")
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys
import numpy as np

INF = float('inf')


def solve(N: int):
    def manhattan_distance(x1, y1, x2, y2):
        return abs(x1-x2) + abs(y1-y2)
    return min(manhattan_distance(1, 1, i, N//i) for i in range(1, int(math.sqrt(N))+1) if N % i == 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(f'{solve(N)}')


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int):
    def manhattan_distance(x1, y1, x2, y2):
        return abs(x1-x2) + abs(y1-y2)
    return min(manhattan_distance(1, 1, i, N//i) for i in range(1, int(math.sqrt(N))+1) if N % i == 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(f'{solve(N)}')


if __name__ == '__main__':
    main()
x,y = map(int,raw_input().strip().split(' '))
follow = [[] for i in range(n)]
for i in range(y):
    h,c = map(int,raw_input().strip().split(' '))
    follow[h].append(c)
    follow[c].append(h)
 
color = {}
u = 0

for i in range(n):
    if not i in color:
        que = [i]
        color[i] = u
        while len(que) > 0:
            u = que[0]
            for v in follow[u]:
                if not v in color:
                    color[v] = u
                    que.append(v)
            del que[0]
        u += 1
 
 
q = int(raw_input())
for i in range(q):
    h,c = map(int,raw_input().strip().split(' '))
    if color[h] == color[c]:
        print 'yes'
    else:
        print 'no'

### FIXED CODE ###

x,y = map(int,raw_input().strip().split(' '))
follow = [[] for i in range(x)]
for i in range(y):
    s,t = map(int,raw_input().strip().split(' '))
    follow[s].append(t)
    follow[t].append(s)
 
color = {}
c = 0

for i in range(x):
    if not i in color:
        que = [i]
        color[i] = c
        while len(que) > 0:
            u = que[0]
            for v in follow[u]:
                if not v in color:
                    color[v] = c
                    que.append(v)
            del que[0]
        c += 1
 
 
q = int(raw_input())
for i in range(q):
    s,t = map(int,raw_input().strip().split(' '))
    if color[s] == color[t]:
        print 'yes'
    else:
        print 'no'
from itertools import product

n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
    inp = [int(_) for _ in input().split()]
    c[i] = inp[0]
    a[i] = inp[1:]

INIT = 10**10
ans = INIT
#pat = list(product([0, 1], repeat=n))

for p in range(2**n):
    state = [0] * n
    for j in range(n):
        state[j] = (p >> j) & 1

    a_val = [0] * n
    c_yen = 0

    for i in range(n):
        if state[i] == 1:
            c_yen += c[i]
            for j in range(m):
                a_val[j] += a[i][j]

    flag = True
    for i in range(m):
        if a_val[i] < x:
            flag = False
            break
    if flag:
        ans = min(ans, c_yen)

if ans == INIT:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

n, m, x = map(int, input().split())
c = [0] * n
for i in range(n):
    c[i] = [int(_) for _ in input().split()]

ans = 10**10
for i in range(2 ** n):
    state = [0] * n
    for j in range(n):
        state[j] = (i >> j) & 1
    #print(state)
    num = [0] * m
    val = 0

    for j in range(n):
        if state[j] == 1:
            for k in range(m):
                num[k] += c[j][k+1]
            val += c[j][0]

    flag = True
    for j in range(m):
        if num[j] < x:
            flag = False
            break
    if flag:
        ans = min(ans, val)

if ans == 10**10:
    print(-1)
else:
    print(ans)
def main():
  s=input()
  flg=0
  if s.count(s[0])!=2:
    flg=1
  s=s.replace(s[0],'')
  if s.count(s[0])!=2:
    flg=1
  if flg==1:
    print('No')
  else:
    print('Yes')  
main()

### FIXED CODE ###

def main():
  s=input()
  flg=0
  if s.count(s[0])!=2:
    flg=1
  s=s.replace(s[0],'')
  if len(s)>0 and s.count(s[0])!=2:
    flg=1
  if flg==1:
    print('No')
  else:
    print('Yes')  
main()
N, Q = map(int, input().split())
S = input()

nums = [0] * (N+1) 
count = 0
for i in range(len(S)):
    nums[i] = count
    if S[i] == "A" and S[i+1] == "C":
        count += 1

for _ in range(Q):
    l,r = map(int, input().split())
    print(nums[r-1] - nums[l-1])

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

nums = [0] * N
count = 0
for i in range(len(S)-1):
    nums[i] = count
    if S[i] == "A" and S[i+1] == "C":
        count += 1
nums[-1] = count

for _ in range(Q):
    l,r = map(int, input().split())
    print(nums[r-1] - nums[l-1])
import sys
a, b, c = input().split()

if c - a - b > 0:
  print("No")
  sys.exit()

if 4*a*b < (c-a-b)**2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
a, b, c = map(int, input().split())

if c - a - b < 0:
  print("No")
  sys.exit()

if 4*a*b < (c-a-b)**2:
  print("Yes")
else:
  print("No")
N=input()
if N%2==0:
    print(N)
else:
    print(N*2)
    

### FIXED CODE ###

N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)
import math
a,b=map(int, input().split())

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

print(lcm(a, b))

### FIXED CODE ###

import fractions 
a,b=map(int, input().split())

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

print(lcm(a, b))
import math
a, b, c, d = map(int,input().split())
e = (c*d)//(math.gcd(c,d))
l = [c,d,e]
l2 = [0,0,0]
for i in range(0,3):
    if a%l[i] == 0:
        l2[i] = b//l[i] - a//l[i] +1
    else:
        l2[i] = b//l[i] - a//l[i]
print(b-a+1 -l2[0] -l2[1] + l2[2])

### FIXED CODE ###

import fractions
a, b, c, d = map(int,input().split())
e = c*d//fractions.gcd(c,d)
l = [c,d,e]
l2 = [0,0,0]
for i in range(0,3):
    if a%l[i] == 0:
        l2[i] = b//l[i] - a//l[i] +1
    else:
        l2[i] = b//l[i] - a//l[i]
print(b-a+1 -l2[0] -l2[1] + l2[2])
N,M = map(int, input().split())

P = [list(map(int,input().split())) for i in range(M)]
s=[]
c=[]

for i in range(M):
    s.append(P[i][0])
    c.append(P[i][1])
A=[-1]*N

k=0
for i in range (M):
    if (A[s[i]-1]==-1) or (A[s[i]-1]==c[i]):
        A[s[i]-1]=c[i]
    else:
        k=1
        print(-1)
aa=0
if A[0]==0:
    k=1
    print(-1)
if k==0:
    for i in range (M):
        if A[i]==-1:
            A[i] = 0
            if A[0]==0:
                A[0]=1

        aa+=A[i]*pow(10,(M-i-1))

    print(aa)


### FIXED CODE ###

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

P = [list(map(int,input().split())) for i in range(M)]
s=[]
c=[]

for i in range(M):
    s.append(P[i][0])
    c.append(P[i][1])
A=[-1]*N

k=0
for i in range (M):
    if (A[s[i]-1]==-1) or (A[s[i]-1]==c[i]):
        A[s[i]-1]=c[i]
    else:
        k=1
        print(-1)
aa=0
if A[0]==0 and N>1:
    k=1
    print(-1)
if M==0:
    k=1
    if N==1:
        print(0)
    else:
        print(pow(10,(N-1)))

if k==0:
    for i in range (N):
        if A[i]==-1:
            A[i] = 0
            if A[0]==0:
                A[0]=1

        aa+=A[i]*pow(10,(N-i-1))

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

t = 0
now = 1
footprint = [1]

while t < K:
  if A[now-1] not in footprint:
    footprint.append(A[now-1])
    now = A[now-1]
    t += 1
  else:
    s = footprint.index(A[now-1])
    l = t - s + 1
    e = K % l
    now = footprint[i+e]
    break

print(now)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
 
t = 0
now = 1
footprint = [1]
past = [0]*N
past[0] = 1

while t < K:
  if past[A[now-1]-1] == 0:
    now = A[now-1]
    footprint.append(now)
    past[now-1]=1
    t += 1
  else:
    s = footprint.index(A[now-1])
    l = t - s + 1
    e = (K-s) % l
    now = footprint[s+e]
    break
    
print(now)
N = int(input())
l = map(int,input().split())
a = np.array(l)
count = 0

for i in range(len(a)):
  if a[i]%6 = 0 or a[i]%10 == 0:
    count += 1

if count:
  print("APPROVE")
else:
  print("DENIED")

### FIXED CODE ###

import numpy as np
 
N = int(input())
l = list(map(int,input().split()))
a = np.array(l)
count = 0

for i in range(len(a)):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            count += 1

if count:
    print("DENIED")
else:
    print("APPROVED")
n,m=map(int,input().split())

#素集合 無向グラフ
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return False

    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
    return True

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(n)
for i in range(m):
  x,y=map(int,input().split())
  uf.union(x,y)
print(uf.group_count()-1)

### FIXED CODE ###

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

#素集合 無向グラフ
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return False

    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
    return True

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(n)
for i in range(m):
  x,y=map(int,input().split())
  uf.union(x-1,y-1)
print(uf.group_count()-1)
n,m=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
x.sort(key=lambda x: x[0])
#print(x)
num=0
money=0
i=0
if len(x)!=1:
    while num<=m:
        num+=x[i][1]
        money+=x[i][1]*x[i][0]
        i+=1
    #print(num)
    if num>m:
        i-=1
        money-=x[i][0]*(num-m)
    print(money)
else:
    print(x[0][0]*m)

### FIXED CODE ###

n,m=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
x.sort(key=lambda x: x[0])
#print(x)
num=0
money=0
for i in range(n):
    num+=x[i][1]
    money+=x[i][1]*x[i][0]
    if num>m:
        money=money-(num-m)*x[i][0]
        break
print(money)
import math

a, b, c, d = map(int, input().split())
ans = 0

# 最小公倍数
cd = c * d // math.gcd(c, d)

cdiv = int(b / c) - int((a - 1) / c)
ddiv = int(b / d) - int((a - 1) / d)
cddiv = int(b / (cd)) - int((a - 1) / (cd))
ans = (b - a + 1) - (cdiv + ddiv-cddiv)

print(ans)


### FIXED CODE ###

import math


def lcm(a, b):
    return a * b // gcd(a, b)


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


a, b, c, d = map(int, input().split())
ans = 0

# 最小公倍数
cd = lcm(c, d)

bdiv = (b // c) + (b // d) - (b // cd)
adiv = ((a - 1) // c) + ((a - 1) // d) - ((a - 1) // cd)
ans = (b - a) - (bdiv - adiv) + 1

print(ans)
S = int(input())
if S[:2] > 12:
    if 13 > S[2:] > 0
        print("YYMM")
    else:
        print("NA")
elif 0 < S[:2] < 13:#12xx~01xx
    if S[2:] > 12:
        print("MMYY")
    elif 0 < S[2:] < 13:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:#00xx
    if 0 < S[2:] <13:
        print("YYMM")
    else:
        print("NA")


### FIXED CODE ###

S = input()
if int(S[:2]) > 12:
    if 13 > int(S[2:]) > 0:
        print("YYMM")
    else:
        print("NA")
elif 0 < int(S[:2]) < 13:#12xx~01xx
    if int(S[2:]) > 12:
        print("MMYY")
    elif 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:#00xx
    if 0 < int(S[2:]) <13:
        print("YYMM")
    else:
        print("NA")
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,q = map(int,input().split())
graph = [[] for _ in range(n)]
point = [0]*n
for i in range(n-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
for _ in range(q):
    a,b = map(int,input().split())
    a = a -1
    point[a]+=b
def dfs(now, prev = -1):
    for next in graph[now]:
        if next == prev:
            continue
        point[next] += point[now]
        dfs(next, now)
dfs(0)
print(*point)

### FIXED CODE ###

n,q = map(int,input().split())
graph = [[] for _ in range(n)]
point = [0]*n
for i in range(n-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
for _ in range(q):
    a,b = map(int,input().split())
    a = a -1
    point[a]+=b
stack = [];
stack.append(0)
visited = [False]*n
while stack:
    x = stack.pop()
    visited[x] = True
    for y in graph[x]:
        if visited[y] == False:
            point[y] += point[x]
            stack.append(y)
print(*point)
n = int(input())
V = list(map(int, input().split()))

E = V[::2]
O = V[1::2]

from collections import Counter
Ed = Counter(E)
Od = Counter(O)
Edn = Ed.most_common(2)
Odn = Od.most_common(2)
#print(Edn,Odn)
if Edn[0][0] != Odn[0][0]:
    print(n- Edn[0][1] - Odn[0][1])
else:
    if len(Edn) == 1:
        if len(Odn) == 1:
            print(n//2)
        else:
            print(n//2-Odn[1][1])
    elif len(Odn) == 1:
        print(n//2-Edn[1][1])
    else:
        print(min(n-Edn[0][1]-Odn[1][1],m-Edn[1][1]-Odn[0][1]))

### FIXED CODE ###

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

Dic = [[i,0] for i in range(1,(10**5)+1)]
Dic2 = [[i,0] for i in range(1,(10**5)+1)]
for i in range(n):
    if i%2 == 0:
        Dic[V[i]-1][1] += 1
    else:
        Dic2[V[i]-1][1] += 1
Dic.sort(key = lambda x:x[1],reverse = True)
Dic2.sort(key = lambda x:x[1], reverse = True)
#print(Dic,Dic2)
cn = 0
if Dic[0][0] != Dic2[0][0]:
    cn += n - Dic[0][1] - Dic2[0][1]
else:
    cn += n - max((Dic[0][1]+Dic2[1][1]), (Dic[1][1]+Dic2[0][1]))
print(cn)