Harryxun/stf_run huggingface dataset:
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    counter = [[0] * 18 for _ in range(26)]
    ans = 0
    for _ in range(n):
        S = input()
        if '.' in S:
            a, b = S.split('.')
            a = int(a + b + '0' * (9 - len(b)))
        else:
            a = int(S + '0' * 9)
        two = five = 0
        while a % 2 == 0:
            two += 1
            a //= 2
        while a % 5 == 0:
            five += 1
            a //= 5
        for i in range(26):
            for j in range(18):
                if i + two >= 18 and j + five >= 18:
                    ans += counter[i][j]
        counter[two][five] += 1
    print(ans)
resolve()

### FIXED CODE ###

import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from collections import Counter
def resolve():
    n = int(input())
    C = Counter()
    for _ in range(n):
        S = input()
        if '.' in S:
            a, b = S.split('.')
            a = int(a + b + '0' * (9 - len(b)))
        else:
            a = int(S + '0' * 9)
        two = five = 0
        while a % 2 == 0:
            two += 1
            a //= 2
        while a % 5 == 0:
            five += 1
            a //= 5
        C[two, five] += 1

    ans = 0
    for key0, val0 in C.items():
        i0, j0 = key0
        for key1, val1 in C.items():
            i1, j1 = key1
            if i0 + i1 >= 18 and j0 + j1 >= 18:
                if key0 == key1:
                    ans += val0 * (val0 - 1) // 2
                elif key0 < key1:
                    ans += val0 * val1
    print(ans)
resolve()
n = int(input())
c = [6**i for i in range(1,7)]
c.extend([9**i for i in range(1, 6)])
c = sorted(c)[::-1]
dp = [0]*100000
for i in range(1,n+1):
    dp[i]=dp[i-1]+1
    for c_ in c:
        if i>=c_:
            dp[i]=min(dp[i],dp[i-c_]+1)
print(dp[n])

### FIXED CODE ###

n = int(input())
c = [6**i for i in range(1,7)]
c.extend([9**i for i in range(1, 6)])
c = sorted(c)[::-1]
dp = [0]*1000000
for i in range(1,n+1):
    dp[i]=dp[i-1]+1
    for c_ in c:
        if i>=c_:
            dp[i]=min(dp[i],dp[i-c_]+1)
print(dp[n])
r = input()
  
l = 2*math.pi*r
s = r*r*math.pi
  
print "%.8f %.8f" %(float(s), float(l))

### FIXED CODE ###

import math
 
r = float(input())
    
l = 2*math.pi*r
s = r*r*math.pi
    
print "%.8f %.8f" %(s, l)
a, b = map(int, input().split())
c = list(map(int, input().split()))


### FIXED CODE ###

a = int(input())
c = list(map(int, input().split()))
d = {0: 1}
e = 0
for i in range(len(c)):
    e += c[i]
    if e not in d:
        d[e] = 1
    else:
        d[e] += 1
ans = 0
for v in d.values():
    if v >= 2:
        ans += v * (v - 1) // 2
print(ans)
D = input()

if D == 25:
    print("Christmas")
elif D==24:
    print("Christmas Eve")
elif: D==23:
    print("Christmas Eve Eve")
elif: D ==22:
    print("Christmas Eve Eve Eve")

### FIXED CODE ###

D = int(input())

if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")
n = int(input())
a = list(input())

r = 0
for i in range(1000):
  t = str(i).zfill(3)
  ti = 0
  if t[ti] > a[0]:
    a = a[1:]
  for si in range(len(a)):
    if a[si] == t[ti]:
      ti += 1
      if ti == 3:
        break
  if ti == 3:
    r += 1

print(r)
  

### FIXED CODE ###

n = int(input())
a = input()

r = 0
for i in range(10):
  s = a.find(str(i))
  if s == -1:
    continue
  for j in range(10):
    s2 = a.find(str(j), s + 1)
    if s2 == -1:
      continue
    for k in range(10):
      if a.find(str(k), s2 + 1) != -1:
        r += 1
print(r)
def main():
    N, Q = map(int, input().split())
    s = input()
    l = []
    for _ in range(Q):
        t, d = input().split()
        l.append((t, d))
    lmax = N + 1
    lmin = 0
    rmax = N + 1
    rmin = 0
    # find most left R
    while rmax != rmin:
        m = t = (rmax + rmin) // 2
        if t == 0 or t == N + 1:
            break
        for i in range(Q):
            if s[t-1] == l[i][0]:
                if l[i][1] == 'L':
                    t -= 1
                else:
                    t += 1
            if t == N+1:
                rmax = m
                break
        else:
            rmin = m + 1
    # find most right L
    while lmax != lmin:
        m = t = (lmax + lmin + 1) // 2
        if t == 0 or t == N + 1:
            break
        for i in range(Q):
            if s[t-1] == l[i][0]:
                if l[i][1] == 'L':
                    t -= 1
                else:
                    t += 1
            if t == 0:
                lmin = m
                break
        else:
            lmax = m - 1
    print(rmax-lmax-1)
main()


### FIXED CODE ###

def main():
    N, Q = map(int, input().split())
    s = input()
    l = []
    for _ in range(Q):
        t, d = input().split()
        l.append((t, d))
    lmax = N + 1
    lmin = 0
    rmax = N + 1
    rmin = 0
    # find most left R
    t = N
    for i in range(Q):
        if s[t-1] == l[i][0]:
            if l[i][1] == 'L':
                t -= 1
            else:
                t += 1
        if t == N+1:
            break
        if t == 0:
            print('0')
            return 0
    else:
        rmin = N + 1
    while rmax != rmin:
        m = t = (rmax + rmin) // 2
        for i in range(Q):
            if s[t-1] == l[i][0]:
                if l[i][1] == 'L':
                    t -= 1
                else:
                    t += 1
            if t == N+1:
                rmax = m
                break
            if t == 0:
                rmin = m + 1
                break
        else:
            rmin = m + 1
    t = 1
    for i in range(Q):
        if s[t-1] == l[i][0]:
            if l[i][1] == 'L':
                t -= 1
            else:
                t += 1
        if t == 0:
            break
        if t == N + 1:
            print('0')
            return 0
    else:
        lmax = 0
 
    # find most right L
    while lmax != lmin:
        m = t = (lmax + lmin + 1) // 2
        for i in range(Q):
            if s[t-1] == l[i][0]:
                if l[i][1] == 'L':
                    t -= 1
                else:
                    t += 1
            if t == 0:
                lmin = m
                break
            if t == N + 1:
                lmax = m - 1
                break
        else:
            lmax = m - 1
    print(rmax-lmax-1)
main()
a , b = map(int , input().split)
c=str(a)+str(b)
c=int(c)
for i in range (20):
    if c!= int(i^2):
        print("Yes")  
        break      
    elif c==20:
        print("No")
        break

        

### FIXED CODE ###

a , b = map(int , input().split())
c=str(a)+str(b)
c=int(c)
for i in range (1000):
    if c== int(i*i):
        print("Yes")  
        break      
    elif i==1000-1:
        print("No")
        break
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
r, c, d = 0, 0, 3
ret = []
for y in range(h * w - 1):
    if y % w == 0 or y % w == w - 1:
        d = (d + 1) % 4
    dy, dx = [(0, 1), (1, 0), (0, -1), (1, 0)][d]
    if a[r][c] % 2 != 0:
        ret.append((r, c, r + dy, c + dx))
        a[r + dy][c + dx] += 1
    r, c = r + dy, c + dx
print(len(ret))
for r1, c1, r2, c2 in ret:
    print(r1 + 1, c1 + 1, r2 + 1, c2 + 1)


### FIXED CODE ###

h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
r, c, d = 0, 0, 3
ret = []
for y in range(h * w - 1):
    if y % w == 0:
        d = (d + 1) % 4
    if y % w == w - 1:
        d = (d + 1) % 4
    dy, dx = [(0, 1), (1, 0), (0, -1), (1, 0)][d]
    if a[r][c] % 2 != 0:
        ret.append((r, c, r + dy, c + dx))
        a[r + dy][c + dx] += 1
    r, c = r + dy, c + dx
print(len(ret))
for r1, c1, r2, c2 in ret:
    print(r1 + 1, c1 + 1, r2 + 1, c2 + 1)
from sys import  stdin
n = in(stdin.readline())
a = int(stdin.readline())
print n*n-a

### FIXED CODE ###

from sys import  stdin
n = int(stdin.readline())
a = int(stdin.readline())
print n*n-a
import math


def main():
    a, b = map(int, input().split())
    ans = "{:.0f}".format(a * b / math.gcd(a, b))
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    a, b = map(int, input().split())
    ans = round(a * b / gcd(a, b))
    print(ans)


if __name__ == '__main__':
    main()
D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,i,t-G])
    
b = min(l)
p = 0
for j in range(D):
  if ((b[1] >> j) & 1):
    if b[2] < PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct = 1
      while b[2] > [j +1]:
        b[2] -= (j+1)*100
        ct += 1
    
print(b[0]-ct)


### FIXED CODE ###

D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 1):
        continue
      else:
        ck.append(j)
    if ck == []:
      continue
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))
s = input()
k = int(input())

if s[0] == '1':
    print(s[1])
else:
    print(s[0])

### FIXED CODE ###

s = input()
k = int(input())
k = k-1
def not1(t):
    for i in range(len(t)):
        if t[i] != '1':
            return (i, t[i])
    return (-1, '1')
(j, t) = not1(s)
if j == -1:
    print('1')
    exit()
if k < j:
    print('1')
    exit()
if k >= j:
    print(t)
    exit()
S = int(input)
h = S / 3600
m = (S % 3600) / 60
s = (S % 3600) % 60
print(h: m: s)

### FIXED CODE ###

S = int(input())
h = S // 60 //60
m = S // 60 % 60
s = S % 60
print("{0}:{1}:{2}".format(h,m,s))
import collections
N = int(input())
A = list(map(int,input().split()))
A.sort()
A = collections.Counter(A)

ans = 1
count = 0
if N == 1:
    if A[0] == 0:
        ans = 1
    else:
        print(0)

if N % 2 == 0:
    for i in range(1, int(N/2)+1):
        if A[i*2-1] == 2:
            count += 1
        else:
            ans = 0
else:
    if A.count(0) == 1:
        for i in range(1, int(N/2)+1):
            if A[i*2] == 2:
                count += 1

            else:
                ans = 0
    else:
        ans = 0
for i in range(count):
    ans *= 2
    ans %= 1000000007
print(ans)


### FIXED CODE ###

import collections
N = int(input())
A = list(map(int,input().split()))
A.sort()
A = collections.Counter(A)

ans = 1
count = 0
if N == 1:
    if A[0] == 1:
        ans = 1
    else:
        ans = 0

elif N % 2 == 0:
    for i in range(1, int(N/2)+1):
        if A[i*2-1] == 2:
            count += 1
        else:
            ans = 0
else:
    if A[0] == 1:
        for i in range(1, int(N/2)+1):
            if A[i*2] == 2:
                count += 1

            else:
                ans = 0
    else:
        ans = 0
for i in range(count):
    ans *= 2
    ans %= 1000000007
print(ans)
import sys
k = int(input())

remainders = set()
current_remainder = 7 % k
remainders.add(current_remainder)

counter = 1
while True:
    counter += 1
    remainder = remainder * 10 % k
    if remainder in remainders:
        print('-1')
        sys.exit()
    remainders.add(remainder)
    print(remainders)
    if sum(remainders) % k == 0:
        print(counter)
        sys.exit()

### FIXED CODE ###

import sys

k = int(input())
n = 7
counter = 1
remainders = set()

while True:
    remainder = n % k
    if remainder == 0:
        print(counter)
        sys.exit()
    if remainder in remainders:
        print(-1)
        sys.exit()
    remainders.add(remainder)
    
    n = remainder * 10 + 7
    counter += 1
while True :
    (H, W) = [int(i) for i in input().split()]

    if H == W == 0:
        break

    print('#' * W)
    for a in range(H - 2):
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)

??????print()

### FIXED CODE ###

while True:
    (H, W) = [int(i) for i in input().split()]
    
    if H == W == 0 :
        break

    print('#' * W)
    for a in range(H - 2) :
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)
    print()
n,m=map(int,input().split())
ans=set()
ans.add(range(1,m+1))
for n in range(n):
  s=list(map(int,input().split()))
  s=s[1:]
  ans=ans-s
print(len(ans))

### FIXED CODE ###

n,m=map(int,input().split())
ans=set()
b=set(range(1,m+1))
#print(b)
ans=ans.union(b)
for n in range(n):
  #print(ans)
  s=list(map(int,input().split()))
  ex=b - set(s[1:])
  ans=ans-ex
print(len(ans))
N = int(input())
S = input()

s = S.lstrip('.').rstrip('#')

w = s.count('.')
b = n - w

if w < b:
    print(w)
else:
    print(b)

### FIXED CODE ###

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

if a > b and b > c and a > c:
    print('No')
if a > c and a > b and c > b:
    print('Yes')
elif b > a and b > c and a > c:
    print('No')
elif b > c and c > a and b > a:
    print('Yes')
elif c > a and c > b and a > b:
    print('No')
elif  c > b and c > a and b > a:
    print('No')
s,a,x=input(),[],["A","C","G","T"]
b=""
for i in range(len(s)):
  if s[i] in x:b+=s[i]
  else:
    a.append(b)
    b=""
a.sort()
print(len(a[-1]))

### FIXED CODE ###

s,x=input(),["A","C","G","T"]
a,b,c="",0,0
for i in range(len(s)):
  if s[i] in x:
    a+=s[i]
    c+=1
  else:
    a=""
    c=0
  if b<c:b=c
print(b)
a = input()
a = int(N)

print(a+a*a+a*a*a)

### FIXED CODE ###

a = int(input())
print(a+a*a+a*a*a)
N = int.input()
oturi = 1000-(N%1000)
print(oturi)


### FIXED CODE ###

N = int(input())
if N % 1000 == 0:
  print(0)
else:
  print(1000-(N%1000))
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
j=0
while j<N:
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000*a[j]
  j+=1

print(total)


### FIXED CODE ###

N=int(input())
a=[]
b=[]
for i in range(N):
  x,y=input().split()
  a.append(float(x))
  b.append(y)
total=0
for j in range(N):
  if b[j]=='JPY':
    total += a[j]
  else:
    total += 380000.0*a[j]
print(total)
W=int(raw_input())
H=int(raw_input())
x=int(raw_input())
y=int(raw_input())
r=int(raw_input())

if x <= W-r and x >= r:
  if y <= H-r and y >= r:
    print "yes"
else:
  print "no"

### FIXED CODE ###

W,H,x,y,r= map(int, raw_input().split())
if r<=x and r<=y and x<=W-r and y<=H-r:
  print "Yes"
else : print "No"
import numpy as np
from itertools import combinations_with_replacement

N,M,X = map(int,input().split())
CA = []
for i in range(N):
  CA.append(list(map(int,input().split())))

OK = True
CA = np.array(CA)
sums = np.sum(CA,axis=0)
for i in range(1,M):
  if sums[i] < X:
    OK = False
    break
    
if OK == False:
  print(-1)
else:
  min_ = sums[0]
  for A in combinations_with_replacement(range(0, N), r=M):
    A = [*A]
    mini_CA = []
    for i in set(A):
      mini_CA.append(CA[i])
    mini_CA = np.array(mini_CA)
    OK2 = True
    sums = np.sum(mini_CA,axis=0)
    for i in range(1,M):
      if sums[i] < X:
        OK2 = False
        break
    if OK2 == True and sums[0] < min_:
      min_ = sums[0]
      
print(min_)

### FIXED CODE ###

import numpy as np
from itertools import combinations_with_replacement

N,M,X = map(int,input().split())
CA = []
for i in range(N):
  CA.append(list(map(int,input().split())))

OK = True
CA = np.array(CA)
sums = np.sum(CA,axis=0)
for i in range(1,M+1):
  if sums[i] < X:
    OK = False
    break

if OK == False:
  print(-1)
else:
  # As = []
  # for A in combinations_with_replacement(range(0, N), r=M):
  #   As.append(tuple(set(A)))
  # As = list(map(list, set(As)))
  min_ = sums[0]
  hoge = []
  kouho = list(range(1,N+1))
  for i in combinations_with_replacement(kouho, N):
    hoge.append(list(set(i)))
  hoge = list(map(list, set(map(tuple, hoge))))
  for i in hoge:
    mini_CA = []
    for j in i:
      mini_CA.append(CA[j-1])
    mini_CA = np.array(mini_CA)
    OK2 = True
    sums = np.sum(mini_CA,axis=0)
    for k in range(1,M+1):
      if sums[k] < X:
        OK2 = False
        break
    if OK2 == True and sums[0] < min_:
      min_ = sums[0]
  print(min_)
import copy
N,K = list(map(int, input().split()))
 
A = list(map(int, input().split()))
 
count = [0]
Check = [0] * N
for i in range(K):
    countCheck = copy.copy(count)
    count.append(A[count[-1]]-1)
    if(Check[count[-1] == 1]):
        break
 
    Check[count[-1]] = 1
    i += 1
 
 
saisyo = count.index(count[-1]) + 1
 
loop_kazu = len(count) - saisyo
K_loop = K - saisyo
 
ans_index = K_loop % loop_kazu
ans = count[saisyo + ans_index] + 1
 
print(ans)
 

### FIXED CODE ###

import copy
N,K = list(map(int, input().split()))
 
A = list(map(int, input().split()))
 
count = [0]
Check = [0] * N
for i in range(K):
    count.append(A[count[-1]]-1)
#    print(count)
    if(Check[count[-1]-1] == 1):
        break
 
    Check[count[-1]-1] = 1
    i += 1
 
saisyo = count.index(count[-1]) + 1
#print(count,saisyo)
 
if(saisyo == len(count)):
    saisyo = 0
 
loop_kazu = len(count) - saisyo
 
if(K > loop_kazu):
    K_loop = K - saisyo
 
    ans_index = K_loop % loop_kazu
    ans = count[saisyo + ans_index] + 1
 
    print(ans)
 
else:
    print(count[K]+1)
N=input()
a=list(map(int, input()))
b=a
c=1
if c<=N:
	d=a[c-1]
	b[d-1]='c'
	c+=1
''.join(b)

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
ans=[0]*N
for i in range(N):
	b=a[i]-1
	ans[b]=i+1
for i in range(N):
	print(ans[i])
import math

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

if math.abs(math.sqrt(n)**2 - n) < 1e-6:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math

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

m = int(math.sqrt(n))

if abs(m**2 - n) < 1e-6:
    print("Yes")
else:
    print("No")
from collections import defaultdict

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

d = defaultdict(int)
for x in a:
  d[x] += 1

av = reverse(sorted(d.values()))
ks = 0
idx = 0
while ks < k:
  ks += av[idx]
  idx += 1
print(idx)

### FIXED CODE ###

from collections import defaultdict

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

d = defaultdict(int)
for x in a:
    d[x] += 1

av = list(sorted(d.values()))
ks = 0
idx = 0
print(sum(av[0:-k]))
# D
res = 0

A = int(input())
B = int(input())

def pow2_floor_log2(x):
    res = 1
    while res*2 <= x:
        res *= 2
    return res


while True:
    # find log2A and log2B
    C = pow2_floor_log2(B)
    if A < C:
        # A to C
        res += C - A
        if B > C:
            B_ = C + pow2_floor_log2(B - C)*2 - 1
        if C + A <= B_:
            res += C
            break
        else:
            res += (C - A) + (B_ - C + 1)
            break
    else:
        A -= C
        B -= C

print(res)

### FIXED CODE ###

# D
res = 0

A = int(input())
B = int(input())

def pow2_floor_log2(x):
    res = 1
    while res*2 <= x:
        res *= 2
    return res

if A == B:
    res += 1
    
while A < B:
    # find log2A and log2B
    C = pow2_floor_log2(B)
    if A < C:
        # A to C
        res += C - A
        if B > C:
            B_ = C + pow2_floor_log2(B - C)*2 - 1
        else:
            B_ = C
        if C + A <= B_:
            res += C
            break
        else:
            res += (C - A) + (B_ - C + 1)
            break
    else:
        A -= C
        B -= C

print(res)
H = int(input())
count = 0

def helper(x):
  if x == 1:
    global count
    count += 1
    return
  count += 1
  helper(x/2)
  helper(x/2)

helper(H)
print(count)

### FIXED CODE ###

H = int(input())
count = 0

def helper(x):
  if x == 1:
    return 1
  return helper(x//2) * 2 + 1

print(helper(H))
import sys
sys.setrecursionlimit(10**4)


def rootedTree(node,parent,root,add):
    A.append([node,parent,root,add])
    for root_num,num in root:
        if len(tree[root_num])!=0:
            rootedTree(root_num,node,tree[root_num],num)
        else:
            A.append([root_num,node,tree[root_num],num])


n=int(input())
AB=[list(map(int,input().split()))+[i+1] for i in range(n-1)]
A=[]
tree=[[] for i in range(n+1)]
for a,b,c in AB:
    tree[a] +=[[b,c]]

rootedTree(1,0,tree[1],0)
ans=[0]*n
for node,parent,root,num in A:
    flag=0
    for i,j in enumerate(root):
        if ans[num]==i+1:flag=1
        if flag:
            ans[j[1]]=i+2
            continue
        ans[j[1]]=i+1

print(max(ans))
for i in range(1,n):print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)


def rootedTree(node,parent,root,add):
    A.append([node,parent,root,add])
    for root_num,num in root:
        if len(tree[root_num])!=0:
            rootedTree(root_num,node,tree[root_num],num)
        else:
            A.append([root_num,node,tree[root_num],num])


n=int(input())
AB=[list(map(int,input().split()))+[i+1] for i in range(n-1)]
A=[]
tree=[[] for i in range(n+1)]
for a,b,c in AB:
    tree[a] +=[[b,c]]

rootedTree(1,0,tree[1],0)
ans=[0]*n
for node,parent,root,num in A:
    flag=0
    for i,j in enumerate(root):
        if ans[num]==i+1:flag=1
        if flag:
            ans[j[1]]=i+2
            continue
        ans[j[1]]=i+1

print(max(ans))
for i in range(1,n):print(ans[i])
i = set(map(str, input().split()))
  if ( '1' in i and '9' in i and '7' in i and '4' in i ):
      print ('YES')
  else:
      print ('NO')

### FIXED CODE ###

i = set(map(str, input().split()))
if ( '1' in i and '9' in i and '7' in i and '4' in i ):
    print ('YES')
else:
    print ('NO')
while True:
(a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]

if op == '?':
break
elif op =='+':
print(a + b)
elif op == '-':
print(a - b)
elif op == '*':
print(a * b)
else op == '/':
print(a // b)

### FIXED CODE ###

while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]
    if op == '?':
        break
    elif op =='+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)
from collections import Counter

n = int(input())
vn = list(map(int,input().split()))
vn_odd = [vn[i] for i in range(n) if i%2==1]
vn_even = [vn[i] for i in range(n) if i%2==0]
odd_freq = Counter(vn_odd).most_common(2)
even_freq = Counter(vn_even).most_common(2)

ans = 0

if odd_freq[0][0] != even_freq[0][0]:
    ans += n - odd_freq[0][1] - even_freq[0][1]
else:
    if odd_freq[0][1] > even_freq[0][1]:
        ans += n - odd_freq[0][1] - even_freq[1][1]
    elif odd_freq[0][1] < even_freq[0][1]:
        ans += n - odd_freq[1][1] - even_freq[0][1]
    else:
        if odd_freq[1][1] >= even_freq[1][1]:
            ans += n - odd_freq[1][1] - even_freq[0][1]
        else:
            ans += n - odd_freq[0][1] - even_freq[1][1]

            
print(ans)


### FIXED CODE ###

import collections
 
def counter_top(c, exclude):
  for a in c.most_common():
    if a[0] != exclude:
      return a
  return (object(), 0)
 
def conv_seq(seq, exclude=None):
  c = collections.Counter(seq)
  mc = counter_top(c, exclude)
  return sum(c.values()) - mc[1], mc[0]
 
input()
vals = list(map(int, input().split()))
s1, a = conv_seq(vals[::2])
s2, b = conv_seq(vals[1::2])
if a != b:
  print(s1 + s2)
else:
  s1_new, _ = conv_seq(vals[::2], exclude=b)
  s2_new, _ = conv_seq(vals[1::2], exclude=a)
  print(min(s1_new + s2, s1 + s2_new))