Harryxun/stf_run huggingface dataset:
import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N = SINGLE_INT()

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

if is_integer_num(N/2):
    print(N)
else:
    print(N*2)

### FIXED CODE ###

S = input()
S = list(S)


S = [int(1) if x == '+' else int(-1) for x in S]

print(sum(S))
n,q = map(int, input().split())
a = []
for i in range(n-1):
    a.append((input()))

b = []
for j in range(q):
    b.append((input()))
    
aws = []
for k in range(n):
    aws.append(0)
    
def tree(t_num,point):
    aws[t_num - 1] +=  point
    for an in a:
        if t_num == int(an.split()[0]):
            tree(int(an.split()[1]),point)
for bn in b:
    t_num = int(bn.split()[0])
    point = int(bn.split()[1])
    tree(t_num,point)
    
aws_2 = []
for h in aws:
    str_h = str(h)
    aws_2.append(str_h)
print(" ".join(aws_2))


### FIXED CODE ###

n = int(input())
numbers = list(map(int,input().split()))
 
def aaa(numbers):
    if len(numbers) > 1:
        numbers.sort()
        new_number = (numbers[0] + numbers[1]) / 2
        n_0 = numbers[0]
        n_1 = numbers[1]
        numbers.remove(n_0)
        numbers.remove(n_1)
        numbers.append(new_number)
        aaa(numbers)
    else:
        return numbers[0]
      
aaa(numbers)
print(aaa(numbers))
H, W = map(int, input().split())
S = ['.'*(W+2)] + ['.' + input() + '.' for _ in range(H)] + ['.'*(W+2)]
for i in range(1, H+1):
  for j in range(1, W+1):
    if S[i][j] == '#':
      for x, y in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        if S[i+x][j+y] == '#':
          break
      else:
        print('No')
        return
else:
  print('Yes')


### FIXED CODE ###

import sys

H, W = map(int, input().split())
S = ['.'*(W+2)] + ['.' + input() + '.' for _ in range(H)] + ['.'*(W+2)]
for i in range(1, H+1):
  for j in range(1, W+1):
    if S[i][j] == '#':
      for x, y in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        if S[i+x][j+y] == '#':
          break
      else:
        print('No')
        sys.exit()
else:
  print('Yes')
n,k = map(int,input().split( ))
h = list(map(int, input().split( )))
dp =[abs(h[i]-h[0]) for i in range(k)]
for i in range(2,k):
    tmp =[]
    for j in range(i+1):
        #tmp =[]
        #print(*dp)
        #print(dp[j])
        #print(*h)
        #print(h[i],h[j],i,j)
        tmp.append(dp[j]+abs(h[i]-h[j]))#こっちはdp[j],h[j]
    dp[i]= min(tmp)
for i in range(k,n):
    tmp =[]
    for j in range(1,k+1):#+1
        tmp.append(dp[i-j]+abs(h[i]-h[i-j]))#こっちはdp[i-j],h[i-j]
    dp.append(min(tmp))
#print(*dp)
print(dp[n-1])


### FIXED CODE ###

import sys
n,k = map(int,input().split( ))
if k>n:
    flag =1
else:
    flag =0
    
k = min(k,n)
h = list(map(int, input().split( )))
dp =[abs(h[i]-h[0]) for i in range(k)]
for i in range(2,k):
    tmp =[]
    for j in range(i+1):
        #tmp =[]
        #print(*dp)
        #print(dp[j])
        #print(*h)
        #print(h[i],h[j],i,j)
        tmp.append(dp[j]+abs(h[i]-h[j]))#こっちはdp[j],h[j]
    dp[i]= min(tmp)
if flag:
    print(dp[-1])
    sys.exit()
for i in range(k,n):
    tmp =[]
    for j in range(1,k+1):#+1
        tmp.append(dp[i-j]+abs(h[i]-h[i-j]))#こっちはdp[i-j],h[i-j]
    dp.append(min(tmp))
#print(*dp)
print(dp[n-1])
import math
A,B,H,M = map(int,input().split())
A2 = A**2
B2 = B**2
pi = round(math.pi,20)
a = 30*H + 0.5*M
b = M*6
F  = 0
if abs(a-b) == 180:
    F = 1
    print(A+B)
elif abs(a-b) ==0:
    F = 1
    print(0)
elif abs(A-B) < 180:
    angle = round(math.cos(math.radians(abs(a-b))),20)
elif 180 < abs(a-b) and 0 < abs(a-b):
    angle = round(math.cos(math.radians(abs(360-a-b))),20)

if F == 0:
    ab_angle = round(2*A*B*angle,20)
    print(round((A2 + B2 - ab_angle)**0.5,20))

### FIXED CODE ###

import math
A,B,H,M = map(int,input().split())
a = 30*H + 0.5*M
b = M*6
if abs(a-b) < 180:
    ab = abs(a-b)
else:
    ab = 360 - abs(a-b)
ab1 = round(math.cos(math.radians(ab)),20)
ans = round(math.sqrt(A**2 + B**2 - 2 * A* B*ab1),20)
print(round(ans,20))
import sys
sys.setrecursionlimit(100000)
line=sys.stdin.readline

n,q=map(int,line().split())
A=[[] for i in range(n)]
node=[0]*n

for i in range(n-1):
    a,b=map(int,line().split())
    a -=1;b -=1
    A[a].append(b)
    A[b].append(a)

for i in range(q):
    p,x=map(int,line().split())
    node[p-1] +=x


def calculate(num,pre=-1):
    for i in A[num]:
        if i==pre:continue
        node[i] +=node[num]
        calculate(i,num)


calculate(0)
print(*node)

### FIXED CODE ###

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

#n = int(input())
n,q = [int(i) for i in readline().split()]

g = [[] for _ in range(n)]
for i in range(n-1):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append(b-1)
    g[b-1].append(a-1)

add = [0]*n
for _ in range(q):
    p,x = [int(i) for i in readline().split()]
    add[p-1] += x

ans = [0]*n
#ans[0] = add[0]

def dfs(v,p,value): #p: parent of v
    value += add[v]
    ans[v] = value
    for c in g[v]:
        if c == p: continue
        dfs(c,v,value)

dfs(0,-1,0)

#print(add)

print(*ans)
import math
n,k = map(int,input().split())

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,k+1):
    red = n - k
    blue = i
    print(combinations_count(red+1,blue)*combinations_count(k-1,i-1)%(10**9+7))

### FIXED CODE ###

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) if n-r >= 0 else 0

for i in range(1,k+1):
    red = n - k
    blue = i
    print(combinations_count(red+1,blue)*combinations_count(k-1,i-1)%(10**9+7))
x = (int)input()
printt(x*x*x)


### FIXED CODE ###

x = int(input())
print(x*x*x)
A = int(input())
B = input()
k = int(input())
for v in B:
    print(B if k[k-1] == B else "*")

### FIXED CODE ###

input()
B = input()
k = int(input())
for v in B:
    print(v if B[k-1] == v else "*",end="")
def resolve():
    '''
    code here
    '''

    import collections
    N = int(input())
    S_list = [collections.Counter(input()) for _ in range(N)]

    abcd_list = string.ascii_lowercase
    cnt_dict = S_list[0]

    for line in S_list:
        for item in cnt_dict.keys():
            cnt_dict[item] = min(line[item], cnt_dict[item])
        prev_dict = cnt_dict
        # print(cnt_dict)
    
    cnt_tuple = sorted(cnt_dict.items())
    # print(cnt_tuple)
    res = ''
    for i, v in cnt_tuple:
        if v > 0:
            res += i*v

    print(res)

if __name__ == "__main__":
    resolve()    



### FIXED CODE ###

def resolve():
    '''
    code here
    '''

    import collections
    N = int(input())
    S_list = [collections.Counter(input()) for _ in range(N)]

    cnt_dict = S_list[0]

    for line in S_list:
        for item in cnt_dict.keys():
            cnt_dict[item] = min(line[item], cnt_dict[item])
        prev_dict = cnt_dict
        # print(cnt_dict)
    
    cnt_tuple = sorted(cnt_dict.items())
    # print(cnt_tuple)
    res = ''
    for i, v in cnt_tuple:
        if v > 0:
            res += i*v

    print(res)

if __name__ == "__main__":
    resolve()
w,h,x,y=map(int,input().split())

if w/2 == x and h/2 == y:
  way=1
  s=w*h/2

elif (x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h):
  way=0
  s=w*h/2

elif y/x == h/w:
  way=0
  s=w*h/2

else:
  oy,yh,ox,xw=y,h-y,x,w-x
  yoko=min(oy*w,yh*w)
  tate=min(ox*h,xw*h)
  way=0
  s=max(yoko,tate)

print(float(s),way)

### FIXED CODE ###

W,H,x,y=map(int,input().split())
ways=1 if (W/2 == x) and (H/2 == y) else 0
print(W*H/2,ways)
A, B=map(int,input().split())
y=1+(A-1)*x
x=0
while y<B:
  x+=1
print(x)  

### FIXED CODE ###

A, B=map(int,input().split())
y=1
x=0
while y<B:
  y+=(A-1)
  x+=1
  
print(x)
n = list(input())
a, b = map(int, input())

count = 0
for j in range(n)
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)

### FIXED CODE ###

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

x = []
for j in range(1, m + 1):
    n = list(str(j))
    l = [int(n[i]) for i in range(len(n))]
    if len(l) == 1:
        l.append(0)
    s = sum(l)
    if a <= s and s <= b:
        x.append(j)
print(sum(x))
import math,bisect
N,K = map(int,input().split())
A = list(map(int,input().split()))
if K==0:
    print(sum(A))
else:
    A = sorted(A)
    ind = bisect.bisect_right(A,K)
    A = A[:ind]
    a = A[-1]
    n1 = math.floor(math.log2(a))+1
    n2 = math.floor(math.log2(K))+1
    cnt = 0
    k = n2-1
    while k>=0:
        B = [(A[i]//(2**k))%2 for i in range(N)]
        b = sum(B)
        cnt += 2**k*max(b,N-b)
        k -= 1
    if n1>n2:
        k = n1-1
        while k>n2-1:
            B = [(A[i]//(2**k))%2 for i in range(N)]
            b = sum(B)
            cnt += 2**k*max(b,N-b)
            k -= 1 
    print(cnt)

### FIXED CODE ###

import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
a1 = max(A)
n = int(math.log2(max(a1,K)))+1
B = [0 for _ in range(n)]
for i in range(N):
    a = bin(A[i])[2:]
    for j in range(len(a)):
        if a[len(a)-1-j]=="1":
            B[j] += 1
x = bin(K)[2:]
y = ""
flag = 0
for i in range(len(x)):
    if flag==0:
        if x[i]=="0":
            y += x[i]
        else:
            if B[len(x)-1-i]<=N//2:
                y += x[i]
            else:
                y += "0"
                flag = 1
    else:
        if B[len(x)-1-i]<=N//2:
            y += "1"
        else:
            y += "0"
y = int(y,2)
cnt = 0
for i in range(N):
    cnt += y^A[i]
print(cnt)
s = int(input())

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

count = 0
box = []

for i in range(s-1):
    if a[i] >= a[i+1]:
        count += 1
    else:
        count = 0
        
    box.append(count)
    
print(max(box))
        


### FIXED CODE ###

s = int(input())

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

count = 0
box = []


for i in range(s-1):
    if a[i] >= a[i+1]:
        count += 1
    else:
        count = 0
        
    box.append(count)
    
print(max(box)) if s >=2 else print(0)
X,T = map(int, input().split(' '))

print(f'{T/X/1.0}000)

### FIXED CODE ###

N = input()
L = list(map(int, input().split(' ')))

flg = 0
for l in L:
  if not sum(L)-l > l:
    print('No')
    flg = 1

if not flg: print('Yes')
l=raw_input()
k=l.split()
a=0.0
b=0.0
a=int(k[0])
b=int(k[1])
#
print int((a-(a%b))/b),
print int(a%b),
a*=1.0
b*=1.0
if b==1:
        print a*1.0
else:
        if a/b>0.0000002:
                print a/b
        else:   print 0.00000001.99999982

### FIXED CODE ###

l=raw_input()
k=l.split()
a=0.0
b=0.0
a=int(k[0])
b=int(k[1])
#
print int((a-(a%b))/b),
print int(a%b),
a*=1.0
b*=1.0
if b==1:
        print a*1.0
else:
        if a/b>0.0000002:
                print a/b
        else:   print "0.00000001.99999982"
import math

def norm(p, q): # normal vector: (p -> q) * -1j
    return (q[1] - p[1], p[0] - q[1])

def magnitude(a):
    return (a[0]**2 + a[1]**2)**.5

def dot(p, q):
    return p[0]*q[0] + p[1]*q[1]

def angle(p, q):
    return math.acos(dot(p, q) / (magnitude(p) * magnitude(q)))

def cross(a, b, c):
    return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])

def convex_hull(ps):
    ps = sorted(ps)
    qs = []
    n = len(ps)
    for p in ps:
        while len(qs) > 1 and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(n - 2, -1, -1):
        p = ps[i]
        while len(qs) > t and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    return qs

n = int(input())
s = [tuple(map(int, input().split())) for _ in range(n)]
ch = convex_hull(s)
ch.pop()
m = len(ch)
d = dict()
for i in range(m):
  u = angle(norm(ch[i-1], ch[i]), norm(ch[i], ch[(i+1)%m]))
  d[ch[i]] = u / 2 / math.pi
for t in s:
  print(0.0 if t not in d else d[t])

### FIXED CODE ###

import math

def norm(p, q): # normal vector: (p -> q) * -1j
    return (q[1] - p[1], p[0] - q[0])

def magnitude(a):
    return (a[0]**2 + a[1]**2)**.5

def dot(p, q):
    return p[0]*q[0] + p[1]*q[1]

def angle(p, q):
    return math.acos(dot(p, q) / (magnitude(p) * magnitude(q)))

def cross(a, b, c):
    return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])

def convex_hull(ps):
    ps = sorted(ps)
    qs = []
    n = len(ps)
    for p in ps:
        while len(qs) > 1 and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(n - 2, -1, -1):
        p = ps[i]
        while len(qs) > t and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    return qs

n = int(input())
s = [tuple(map(int, input().split())) for _ in range(n)]
ch = convex_hull(s)
ch.pop()
m = len(ch)
d = dict()
for i in range(m):
  u = angle(norm(ch[i-1], ch[i]), norm(ch[i], ch[(i+1)%m]))
  d[ch[i]] = u / 2 / math.pi
for t in s:
  print(0.0 if t not in d else d[t])
import fractions

n=int(input())
t=[int(input()) for _ in range(n)]
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, t[i])
print(ans)

### FIXED CODE ###

import fractions

n=int(input())
t=[int(input()) for _ in range(n)]
ans = t[0]
for i in range(1, n):
    ans = ans * t[i] // fractions.gcd(ans, t[i])
print(ans)
import sys
input = sys.stdin.buffer.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n, m, x = map(int, input().split())
l=[]
for i in range(n):
    l.append(list(map(int, input().split())))
#print(l)
ans=[]
mon = [0]*(2**n)

for i in range(2**n):
    ans1 = 0
    ans2 = 0
    ans3 = 0
    #print(bin(i))
    #print(anss, mon)
    for j in range(n):
        #print(l[j][0])
        #print(i-2**(n-1))
        if ((i>>j)&1):
            mon[i]+=l[j][0]
            ans1+=l[j][1]
            ans2 += l[j][2]
            ans3+=l[j][3]
            #print(mon)
    #print(ans1, ans2, ans3)
    if ans1<x:
        continue
    if ans2<x:
        continue
    if ans3<x:
        continue
    #print(ans1,ans2,ans3)
    ans.append(mon[i])
#print(mon,ans)
if ans!=[]:
    print(min(ans))
else:
    print(-1)


### FIXED CODE ###

import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n, m, x = map(int, input().split())
l = []
for i in range(n):
    l.append(list(map(int, input().split())))
#print(l)
ans = []
mon = [0]*(2**n)

def ok(anss,x):
    for i in range(len(anss)):
        if anss[i]<x:
            return False
    return True

for i in range(2**n):
    #print(bin(i))
    #print(anss, mon)
    anss=[0]*m
    for j in range(n):
        #print(l[j][0])
        #print(i-2**(n-1))
        if ((i >> j) & 1):
            mon[i] += l[j][0]
            for k in range(1,m+1):
                anss[k-1]+=l[j][k]
    #print(anss)
    if ok(anss,x):
        #print(ans)
        ans.append(mon[i])
#print(mon,ans)
if ans != []:
    print(min(ans))
else:
    print(-1)
line=input()
line=line.rstrip().split(" ")
list1=[]
for i in range(N):
    list1.append(int(line[i])-i-1)
#print(list1)

list2=[]
list3=[]
for j in range(2):
    for k in range(N):
        list2.append(abs(list1[k]-1-j))
        
    list3.append(sum(list2))
    list2=[]
#print(list3)

if list3[0]==list3[1]:
    print(list3[0])
elif list3[0]<list3[1]:
    list2=[]
    list3=[]
    count=100000000000000000
    for l in range(1000000000):
        for m in range(N):
            list2.append(abs(list1[m]-1+l))
        if count>=sum(list2):
            count=sum(list2)
            #print(list2)
            list2=[]
            l=l+10
        else:
            count=100000000000000000
            for n in range(l,l+11):
                for o in range(N):
                    list2.append(abs(list1[o]-1+(n-10)))
                if count>=sum(list2):
                    count=sum(list2)
                    list2=[]
                else:
                    print(count)
                    break
                    
            
        
else: 
    list2=[]
    list3=[]
    count=100000000000000000
    for l in range(1000000000):
        for m in range(N):
            list2.append(abs(list1[m]-1-l))
        if count>=sum(list2):
            count=sum(list2)
            list2=[]
            l=l+10
        else:
            count=100000000000000000
            for n in range(l,l+11):
                for o in range(N):
                    list2.append(abs(list1[o]-1+(n-10)))
                if count>=sum(list2):
                    count=sum(list2)
                    list2=[]
                else:
                    print(count)
                    break
                    
        

### FIXED CODE ###

N=int(input())

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

if N==1:
    print(0)
    exit()
elif N==2:
    B=[A[0]-1,A[1]-2]
    b=sum(B)//2
else:
    B=[]
    for i in range(N):
        B.append(A[i]-(1+i))
    #print(B)
    B.sort()
    #print(B)
    b=B[N//2]

ans=0
for i in range(N):
    ans+=abs(A[i]-(b+1+i))
print(ans)
from math import factorial

n = int(input())
a = list(map(int,input().split()))
a_s = set(a)
for i in range(n):
    l = a[i]
    a[i] = 'X'
    ans = 0
    for j in a_s:
        c = a.count(j)
        if c < 2:
            continue
        ans += factorial(c) / factorial(2) / factorial(c - 2)
    print(int(ans))
    a[i] = l

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int,input().split()))

c = Counter(a)
key = c.keys()
comb = 0
for i in key:
    comb += (c[i]) * (c[i]-1) // 2

for i in a:
    ans = comb - (c[i]-1)
    print(ans)
n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = raw_input().split()
  u = int(str[0])
  k = int(str[1])
  for j in range(k):
    v = int(str[j])
    c = int(str[j])
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]

d[0] = 0
color[0] = 1

while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
    print minv
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])

### FIXED CODE ###

n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = str[0]
  k = str[1]
  for j in range(k):
    v = str[2+2*j]
    c = str[3+2*j]
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]
 
d[0] = 0
color[0] = 1
 
while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])
N, Q = list(map(int, input().split()))
s = input()

char = {}
for i, c in enumerate(s):
    if c not in char.keys():
        char[c] = [i]
    else:
        char[c] = char[c] + [i]

count = [1] * N
out = 0
for _ in range(Q):
    A, L = input().split()
    try:
        idx = char[A]
    except KeyError:
        continue

    if L == "L":
        for ix in idx:
            temp = count[ix]
            count[ix] = 0
            if ix == 0:
                out += temp
            else:
                count[ix - 1] += temp
    else:
        for ix in idx:
            temp = count[ix]
            count[ix] = 0
            if ix == N - 1:
                out += temp
            else:
                count[ix + 1] += temp

print(N - out)


### FIXED CODE ###

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

if a == b == c:
    print("Yes")
else:
    print("No")
S = input()

if S = 'ABC':
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

S = input()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')
from collections import Counter
n = int(input())
arr = list(map(int, input().split()))

odd_list =[]
num_list =[]

for i in range(n):
    if i%2 == 0:
        odd_list.append(arr[i])
    if i%2 != 0:
        num_list.append(arr[i])

odd_count = Counter(odd_list)
num_count = Counter(num_list)
odd1 = odd_count[odd_count.most_common()[0][0]]
num1 = num_count[num_count.most_common()[0][0]]


if len(set(arr)) == 1:
    print(int(n/2))
    exit()

if len(set(odd_count)) == 1 and len(set(num_count)) != 1:
    num2 = num_count[num_count.most_common()[1][0]]
    if odd_list[0] == num_count.most_common()[0][0]:
        print(int(n/2)-num2)
        exit()
    if odd_list[0] != num_count.most_common()[0][0]:
        print(int(n/2)-num1)
        exit()

if len(set(odd_count)) != 1 and len(set(num_count)) == 1:
    odd2 = odd_list[odd_count.most_common()[1][0]]
    if num_list[0] == odd_count.most_common()[0][0]:
        print(int(n/2)-odd2)
        exit()
    if num_list[0] != odd_count.most_common()[0][0]:
        print(int(n/2)-odd1)
        exit()

odd2 = odd_count[odd_count.most_common()[1][0]]
num2 = num_count[num_count.most_common()[1][0]]

if odd_count.most_common()[0][0] != num_count.most_common()[0][0]:
    print(n-odd1-num1)

if odd_count.most_common()[0][0] == num_count.most_common()[0][0]:
    print(min(n-odd1-num2, n-odd2-num1))

### FIXED CODE ###

from collections import Counter
n = int(input())
arr = list(map(int, input().split()))

odd_list =[]
num_list =[]

for i in range(n):
    if i%2 == 0:
        odd_list.append(arr[i])
    if i%2 != 0:
        num_list.append(arr[i])

odd_count = Counter(odd_list)
num_count = Counter(num_list)
odd1 = odd_count[odd_count.most_common()[0][0]]
num1 = num_count[num_count.most_common()[0][0]]

if odd1 != num1:
    print(n-odd_count.most_common()[0][1]-num_count.most_common()[0][1])
    exit()

if len(set(arr)) == 1:
    print(int(n/2))
    exit()

if len(set(num_list))==1 and len(set(odd_list))==1:
    print(0)
    exit()

if len(set(odd_count)) == 1 and len(set(num_count)) != 1:
    num2 = num_count[num_count.most_common()[1][0]]
    if odd_list[0] == num_count.most_common()[0][0]:
        print(int(n/2)-num2)
        exit()
    if odd_list[0] != num_count.most_common()[0][0]:
        print(int(n/2)-num1)
        exit()

if len(set(odd_count)) != 1 and len(set(num_count)) == 1:
    odd2 = odd_list[odd_count.most_common()[1][0]]
    if num_list[0] == odd_count.most_common()[0][0]:
        print(int(n/2)-odd2)
        exit()
    if num_list[0] != odd_count.most_common()[0][0]:
        print(int(n/2)-odd1)
        exit()

odd2 = odd_count[odd_count.most_common()[1][0]]
num2 = num_count[num_count.most_common()[1][0]]

if odd_count.most_common()[0][0] != num_count.most_common()[0][0]:
    print(n-odd1-num1)

if odd_count.most_common()[0][0] == num_count.most_common()[0][0]:
    print(min(n-odd1-num2, n-odd2-num1))
n=int(input())
c=list(map(int, input().split()))
c.sort(reverse=True)
a=0
b=0
for i in range(n):
    if i%2==0:
        a=a+c[i]
    else:
        b=b+c[i]
print(a-b)

### FIXED CODE ###

num=int(input())
a=int(input())

b=num%500
if b>a:
    print("No")
else:
    print("Yes")
x1,y1,x2,y2=map(int,input().split());x3,y3,x4,y4=x2-(y2-y1),y2+(x2-x1),x3-(x2-x1),y3-(y2-y1);print(x3,y3,x4,y4)

### FIXED CODE ###

x1,y1,x2,y2=map(int,input().split());x3,y3=x2-(y2-y1),y2+(x2-x1);x4,y4=x3-(x2-x1),y3-(y2-y1);print(x3,y3,x4,y4)
input = int(input())
if input == 0: return 1
return 0

### FIXED CODE ###

def a():
  x :int = int(input())
  if x == 1:
    return 0
  else:
    return 1

if __name__ == '__main__':
  print(a())
n=input()
print(round(n/2))

### FIXED CODE ###

n=int(input())
if n%2==0:
    print(n//2)
else:
    print((n+1)//2)
a,b =list(map(int,input().split()))
import math
print(a*b//math.gcd(a,b))

### FIXED CODE ###

a,b =list(map(int,input().split()))
def gcd(x,y):
	if max(x,y)%min(x,y)==0:return min(x,y)
	else:return  gcd(min(x,y),max(x,y)%min(x,y))
print(a*b//gcd(a,b))