Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	A, B, C = map(int, input().split(" "))
	
	tmp = []
	tmp.append(A)
	tmp.append(B)
	tmp.append(C)
	tmp.sort()
	
	a = abs(tmp[1] - tmp[0])
	b = abs(tmp[2] - tmp[1])
		
	print(a + b)
	
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	A, B, C = map(int, input().split(" "))
	
	tmp = []
	tmp.append(A)
	tmp.append(B)
	tmp.append(C)
	tmp.sort()
	
	a = abs(tmp[1] - tmp[0])
	b = abs(tmp[2] - tmp[1])
		
	print(a + b)
	
if __name__ == "__main__":
	main()
import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res1=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))

### FIXED CODE ###

import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res2=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))
import bisect

def main():
  N,M = map(int,input().split())
  pref = [[] for i in range(N)]
  id = [[]] * M
  
  for i in range(M):
    p,y = map(int,input().split())
    id[i] = [p,y]
    pref[p - 1].append(y)
    #pref[p - 1] = sorted(pref[p - 1])
  
  for i in range(N):
    pref[i] = sorted(pref[i])
  
  orders = [0] * N
  
  for i in range(M):
    p = id[i][0] - 1
    y = id[i][1]
    order = str(bisect.bisect_left(pref[p],y) + 1)
    city = str(p + 1)
    ID = ""
    ID += "0" * (6 - len(city)) + city + "0" * (6 - len(order)) + order
    print(ID)

if __init__ == '__main__':
  main()

### FIXED CODE ###

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

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

for i in range(M):
  L[i].append(i + 1)

sortL = sorted(L)

ID = ""

order = 0

for i in range(0,len(L)):
  if sortL[i][0] > sortL[i-1][0]:
    order = 0
  order += 1
  pref = str(sortL[i][0])
  ID = "0" *  (6 - len(pref))
  ID += pref
  ID += "0" * (6 - len(str(order)))
  ID += str(order)
  sortL[i].append(ID)

sortL.sort(key=lambda x: x[2])

for i in range(0,len(L)):
  print(sortL[i][-1])
A,B=map(int,input().split())
S=input()
number=0
list=[0,1,2,3,4,5,6,7,8,9]
for a in range(A):
    if int(S[a]) in list:
        number+=1
if S[A]=='-':
    number+=1
for a in range(B):
    if int(S[A+a+1]) in list:
        number+=1
if number==A+B+1:
    print('Yes')
else:
    print('No')
    

### FIXED CODE ###

A,B=map(int,input().split())
S=input()
number=0
list=['0','1','2','3','4','5','6','7','8','9']
for a in range(A):
    if S[a] in list:
        number+=1
if S[A]=='-':
    number+=1
for a in range(B):
    if S[A+a+1] in list:
        number+=1
if number==A+B+1:
    print('Yes')
else:
    print('No')
import math
 
a = float(input())
b = float(input())

mean = (a + b) / 2
print(math.ceil(mean))

### FIXED CODE ###

import math
 
a, b = map(float, input().split())

mean = (a + b) / 2
print(math.ceil(mean))
a=10**9+7
n,k=map(int,input().split())
from math import factorial 
def c(t, r):
  return factorial(t)//factorial(t-r)//factorial(r)

for _ in range(1,k+1):
  print((c(n-k+1,_)%a*c(k-1,_-1)%a))

### FIXED CODE ###

mod=10**9+7
n,k=map(int,input().split())

from scipy.misc import comb

for i in range(1,k+1):
  print(comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True)%mod)
import collections
q = collections.deque(maxlen=10000)

n = int(input())
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        q.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            q.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        q.popleft()
    elif com[0] == 'deleteLast':
        q.pop()
print(' '.join(q))

### FIXED CODE ###

import collections
q = collections.deque()
n = int(input())
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        q.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            q.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        q.popleft()
    elif com[0] == 'deleteLast':
        q.pop()
print(*q)
import math
def lcm(a,b):
    return int(a*b /math.gcd(a,b))

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
ans=lcm(t[0],t[1])
for i in range(2,n-1):
    ans=lcm(ans,t[i])
print(ans)



### FIXED CODE ###

def gcd(x,y):
  if x>y: x,y = y,x
  while x:
    x,y = y%x, x
  return y

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

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)
import sys
from itertools import permutations
input = sys.stdin.readline
N = int(input())
S = [input().rstrip('\n') for _ in range(N)]
sum_list = [0] * N
min_list = [0] * N
all_sum = 0
for i in range(N):
    sum = 0
    min = 10**7
    for c in S[i]:
        sum += 1 if c == '(' else -1
        if c == ')' and sum < min:
            min = sum
    sum_list[i], min_list[i] = (sum, min)
    all_sum += sum
if all_sum != 0:
    print('No')
else:
    fin = False
    for p in permutations(range(N), N):
        sum = 0
        for i in p:
            if sum + min_list[i] < 0:
                break
            sum += sum_list[i]
        else:
            print('Yes')
            fin = True
            break
    if not fin:
        print('No')

### FIXED CODE ###

S = input()
T = input()
print('Yes' if T[:len(T) - 1] == S else 'No')
s = 123456789
sum = 0
i = 0

while i < 9:
  sum = sum + s % 10
  s = s // 10
  i = i + 1

if s % sum = 0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

s = int(input())
s_hold = s
sum = 0
i = 0

while i < 9:
  sum = sum + s % 10
  s = s // 10
  i = i + 1

if sum == 0:
  print("Yes")
elif s_hold % sum == 0:
  print("Yes")
else:
  print("No")
A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

for i in K:
	if i % 2 == 0:
		B += A /2
		A /= 2
	else:
		A += B / 2
		B /= 2
print(A + " " + B)

### FIXED CODE ###

A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

for i in range(K):
	if i % 2 == 0:
		A //= 2
		B += A 
	else:
		B //= 2
		A += B 
print(str(A) + " " + str(B))
# -*- coding: utf-8 -*-

def main():
	line = input().strip()
	while line!='':
		print(0)
		line = input().strip()

if __name__=='__main__':
	main()

### FIXED CODE ###

from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input

X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
	v=q.pop(0)
	coor=m[''.join(v)][0]
	x=coor%X
	y=coor//X
	depth=m[''.join(v)][1]
	nextstr=''.join(v)
	if 0<x:
		v[coor],v[coor-1]=v[coor-1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'R']
		v[coor],v[coor-1]=v[coor-1],v[coor]
	if x<X-1:
		v[coor],v[coor+1]=v[coor+1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'L']
		v[coor],v[coor+1]=v[coor+1],v[coor]
	if 0<y:
		v[coor],v[coor-X]=v[coor-X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'D']
		v[coor],v[coor-X]=v[coor-X],v[coor]
	if y<Y-1:
		v[coor],v[coor+X]=v[coor+X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'U']
		v[coor],v[coor+X]=v[coor+X],v[coor]

try:
	while True:
		v=raw_input().split()
		print(m[''.join(v)][1])
except EOFError:
	pass
import sys
input = sys.stdin.readline
N = int(input())
node = [0 for i in range(N)]

neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1]+= 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
def dfs(neighbor,start,visited):
    global k
    global c
    if sum(visited) == N:
        return 0
    for i in neighbor[start]:
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            dfs(neighbor,i,visited)
    return 0
m = max(node)
nn = node.index(m)
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn,visited)
ans2 = ' '.join([str(ans[i]) for i in range(N)])
print(sum(c)-max(c))
print(ans2)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except RuntimeError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn)
"""
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)
a, b, c = map(int, input().split())

if a == b:
    ans = c
elif a == c:
    ans = b:
else:
    ans = a

print(ans)

### FIXED CODE ###

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

if a == b:
    ans = c
elif a == c:
    ans = b
else:
    ans = a

print(ans)
A,B=map(int,input().split())
if A>2B:
  print(A-2*B)
else:
  print(0)

### FIXED CODE ###

A,B=map(int,input().split())
if A>=2*B:
  print(A-2*B)
else:
  print(0)
import math
import sys
from fractions import gcd
m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N, M) = list(map(int,input().split()))
A  = list(map(int,input().split()))
B = [ a//2 for a in A]

def lcmn(B):
    if len(B)<1 :
        return 1
    elif len(B) == 1:
        return B[0]
    
    x = B[0] * B[1] // gcd(B[0],B[1])
    if x > M:
        return -1 

    for i in range(2,len(B)):
        x  = lcmn([x,B[i]])
        if x > M:
        return -1 
    return x
    

#print(N,M,A,B)

# print(lcmn(B))

x = lcmn(B)
if x == -1:
    print(0)
else:
    print((M//x+1)//2)
    

### FIXED CODE ###

import math
import sys
from fractions import gcd
m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N, M) = list(map(int,input().split()))
A  = list(map(int,input().split()))
B = [ a//2 for a in A]

def log2N (x):
    c = 0
    while True:
        if x % 2 != 0:
            return c
        x = x // 2
        c = c + 1


def lcmn(B):
    if len(B)<1 :
        return 1
    elif len(B) == 1:
        return B[0]
    
    x = B[0] * B[1] // gcd(B[0],B[1])
    if x > M:
        return -1 

    for i in range(2,len(B)):
        x  = lcmn([x,B[i]])
        if x > M:
            return -1 
    return x
    

#print(N,M,A,B)

# print(lcmn(B))

p = log2N(B[0])
# print(p)
for i in range(1,len(B)):
    # print(log2N(B[i]))
    if p != log2N(B[i]):
        print(0)
        exit(0)
        
x = lcmn(B)
if x == -1:
    print(0)
else:
    print((M//x+1)//2)
D,N = [int(s) for s in input().split()]
print (100 ** D) * N

### FIXED CODE ###

def LI():
	return [ int(s) for s in input().split() ]
  
D,N = LI()
 
print((100**D) * N) if N != 100 else print((100**D)*(N+1))
N = int(input())
F = []
P = []

for i in range(N):
  f = list(map(int,input().split()))
  F.append(f)
  
for i in range(N):
  p = list(map(int,input().split()))
  P.append(p)
  
value = 0

ans = - (10 ** 9)

def recur(list):
  con = len(list)
  #list = [0,0, ... ~ 0] ~ [1,1, ... ~ 1]
  if con == 10:
    #1がない = 出店していない場合は何も返さない
    if list.count(1) == 0:
        return
    value = 0
    #インデックス番号とF[i] = 店の出店リストを取得
    for n,shop in enumerate(F):
        con = 0
        for j in range(10):
          	#j日に自店が出店し、かつ他店nも出店するならば、カウントする
            if list[j] == 1 and shop[j] == 1:
                con += 1
        #出店リストlistのパターンに応じた店nごとの利益を
        #同時出店日数conから算出し足し合わせる
        value += P[n][con]
 
    global ans
  　
    ans = max(ans, value)
    
  else:
    #出店しない
    recur(list + [0])
    #出店する
    recur(list + [1])
    
recur([])
    
print(ans)

### FIXED CODE ###

N = int(input())
F = []
P = []

for i in range(N):
  f = list(map(int,input().split()))
  F.append(f)
  
for i in range(N):
  p = list(map(int,input().split()))
  P.append(p)
  
value = 0

ans = - (10 ** 9)

def recur(list):
  con = len(list)
  #list = [0,0, ... ~ 0] ~ [1,1, ... ~ 1]
  if con == 10:
    #1がない = 出店していない場合は何も返さない
    if list.count(1) == 0:
      return
    value = 0
    #インデックス番号とF[i] = 店の出店リストを取得
    for n,shop in enumerate(F):
      con = 0
      for j in range(10):
          #j日に自店が出店し、かつ他店nも出店するならば、カウントする
          if list[j] == 1 and shop[j] == 1:
              con += 1
      #出店リストlistのパターンに応じた店nごとの利益を
      #同時出店日数conから算出し足し合わせる
      value += P[n][con]
 
    global ans
  
    ans = max(ans, value)
    
  else:
    #出店しない
    recur(list + [0])
    #出店する
    recur(list + [1])
    
recur([])
    
print(ans)
N=int(input())
A=list(map(int,input().split()))
for i in range(N):
  A[i] = A[i] - i - 1
print( A.sum() // N )


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
for i in range(N):
  A[i] = A[i] - i - 1
A.sort()
b = A[N//2]
ans = 0
for i in range(N):
  ans += abs(A[i] - b)
print(ans)
N,M = map(int,raw_input().split())

W = [['inf' for j in range(N)] for i in range(N)]
y = ['inf' for i in range(N)]
y_t = ['inf' for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = 'inf'
        for k in range(N):
            yj_temp = 'inf'
            if y[k]!='inf' and W[k][j]!='inf':
                yj_temp=y[k]+W[k][j]
            if yj_temp!='inf':
                if yj_temp=='inf':
                    yj_max = yj_temp
                elif yj_max<yj_temp:
                    yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    

print y[N-1]


### FIXED CODE ###

A,B,C = map(int,raw_input().split())

if C>=A and C<=B:
    print 'Yes'
else:
    print 'No'
MAX_INT = 10**6
N, M = map(int, input().split())
room = [set() for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    room[a].add(b)
    room[b].add(a)

dis = [MAX_INT] * (N + 1)
sign = [-1] * (N + 1)
dis[1] = 0
def sign_root(n):
    for i in room[n]:
        if dis[n] + 1 < dis[i] and n in room[i]:
            sign[i] = n
            dis[i] = dis[n] + 1
            room[i].remove(n)
            sign_root(i)
sign_root(1)
if MAX_INT in dis[2:]:
    print("No")
else:
    print("Yes")
    for i in sign[2:]:
        print(i)

### FIXED CODE ###

MAX_INT = 10**6
N, M = map(int, input().split())
room = [set() for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    room[a].add(b)
    room[b].add(a)

dis = [MAX_INT] * (N + 1)
sign = [-1] * (N + 1)
dis[1] = 0
def sign_root(n):
    nxt = []
    for i in room[n]:
        if dis[n] + 1 < dis[i]:
            sign[i] = n
            dis[i] = dis[n] + 1
            nxt += [i]
    return nxt

nxt = sign_root(1)
while nxt != []:
    for i in nxt.copy():
        nxt.pop(0)
        nxt += sign_root(i)
if MAX_INT in dis[2:]:
    print("No")
else:
    print("Yes")
    for i in sign[2:]:
        print(i)
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 


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

n,t = [int(i) for i in readline().split()]
ab = [[int(i) for i in readline().split()] for i in range(n)]


dp = [0]*(t+1)

for a,b in ab:
    c = max(dp[t-a:t])
    dp[-1] = max(dp[-1],c+b)
    
    for i in range(t-1,-1,-1):
        if i-a >= 0:
            dp[i] = max(dp[i], dp[i-a] + b)
        else:
            break
    
    #print(dp)

print(max(dp))

### FIXED CODE ###


import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 


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

n,t = [int(i) for i in readline().split()]
ab = [[int(i) for i in readline().split()] for i in range(n)]

from operator import itemgetter


ab.sort(key = itemgetter(1), reverse = True)
ab.sort(key = itemgetter(0))

dp = [0]*(t)
val = 0

#print(ab)

for a,b in ab:
    for i in range(max(0,t-a),t):
        val = max(val,dp[i]+b)
    
    for i in range(t-1,-1,-1):
        if i-a >= 0:
            if dp[i-a] != 0 or i==a:
                dp[i] = max(dp[i], dp[i-a] + b)
        else:
            break
    #print(dp,val)

print(max(max(dp),val))
N, K, S = map(int, input().split())

if S != 10e9:
    A = [S+1]*N
else:
    A = [2]*N


for i in range(K+1):
    if i % 2 == 0:
        A[i] = S - 1
    else:
        A[i] = 1
A = [str(i) for i in A]
print(' '.join(A))


### FIXED CODE ###

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

A = []
A += [S]*K
if S == pow(10, 9):
    A += [1]*(N-K)
else:
    A += [S+1]*(N-K)


A = [str(i) for i in A]
print(' '.join(A))
"""
偶数番目、機数番目をそれぞれリストに格納
偶数番目の中で、（全て）ー（もっとも要素数が多い数の数）
機数番目の中で、（全て）ー（もっとも要素数が多い数の数）
この和を求めれば良い
→一部WA
→ちょうど2種類ではなく、1種類になってしまうことがあるからでは？

偶数群と奇数群で、最頻値で場合わけ
一致している場合とそうでない場合で計算を変える

"""
import collections


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

even = []
odd = []
for nn in range(n):
    if nn % 2 == 0:
        even.append(V[nn])
    else:
        odd.append(V[nn])

e = collections.Counter(even).most_common()
o = collections.Counter(odd).most_common()

if e[0][0] != o[0][0]:
    print(n - e[0][1] - o[0][1])
elif e[0][0] == n / 2 and o[0][0] == n / 2:
    print(n / 2)
elif e[0][0] == n / 2 and o[0][0] < n / 2:
    print(n - o[0][1])
elif e[0][0] < n / 2 and o[0][0] == n / 2:
    print(n - e[0][1])
else:
    print(n - max(e[1][1] + o[0][1], e[0][1] + o[1][1]))



### FIXED CODE ###

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

even = []
odd = []
for nn in range(n):
    if nn % 2 == 0:
        even.append(V[nn])
    else:
        odd.append(V[nn])

e = collections.Counter(even).most_common()
o = collections.Counter(odd).most_common()

if e[0][0] != o[0][0]:
    print(n - e[0][1] - o[0][1])
else:
    if len(e) == 1 and len(o) == 1:
        print(n // 2)
    elif len(e) == 1 and len(o) >= 2:
        print(n - o[0][1])
    elif len(e) >= 2 and len(o) == 1:
        print(n - e[0][1])
    else:
        print(n - max(e[1][1] + o[0][1], e[0][1] + o[1][1]))
mport copy
import sys
H, W, M= map(int,input().split())
height = [0] * H
width = [0] * W
object = []
for i in range(H):
   wi = [0] * W
   object.append(wi)
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object[h-1, w-1] = 1
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max - 1
p = len(cand_h)*len(cand_w)
if M >= p:
   for i in range(len(cand_h)):
      for j in range(len(cand_w)):
         if object[cand_h[i]][cand_w[j]] == 0:
            ans = h_max + w_max
            break
            break           
else:
   ans += 1
print(ans) 

### FIXED CODE ###

import copy
import sys
H, W, M= map(int,input().split())
height = [0]*H
width = [0]*W
object = []
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object.append([h-1, w-1])
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max
c = 0
p = len(cand_h)*len(cand_w)
cand_h = set(cand_h)
cand_w = set(cand_w)
if M >= p:
   for i in range(len(object)):
      if object[i][0] in cand_h and object[i][1] in cand_w:
         c += 1
print(ans - (c == p))
for i in range(int(input())):
    print input().replace('Hoshino', 'Hoshina')


### FIXED CODE ###

for i in range(int(input())):
    print(input().replace('Hoshino', 'Hoshina'))
n, k = map(int, input().split(' '))
hs = list(map(int, input().split(' ')))
print(len([h for h in hs if h >= k]))

### FIXED CODE ###

n=int(input())
cnt=0
for i in range(1,n+1):
    if i%2==1:
        cnt += 1
print(cnt/n)
s = str(input())
L = len(s)
dict = {}
for i in range(L):
  amari = s[i:] % 2019
  if not(amari in dict.keys()):
    dict[amari] = 1
  else:
    dict[amari] += 1
ans = 0
for key in dict.keys():
  ans += (dict[amari]*(dict[amari]-1))/2
print(ans)

### FIXED CODE ###

s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))
import math
import bisect


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    needed_prime = [2]
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return needed_prime + data
        prime.append(p)
        if int((p + 1) / 2) in prime and p != 2:
            needed_prime.append(p)
        data = [e for e in data if (e % p != 0)]


arr = get_sieve_of_eratosthenes(100000)


Q = int(input())
for q in range(Q):
    l, r = map(int, input().split())
    left_ind = bisect.bisect_left(arr_2, l)
    right_ind = bisect.bisect_right(arr_2, r)
    print(right_ind - left_ind)

### FIXED CODE ###

import bisect
import math

def prime(n):
    for j in range(2, int(math.sqrt(n) + 1)):
        if n % j == 0:
            return False
    return True

lis = []
for i in range(3, 100000, 2):
    if prime(i) and prime((i + 1) / 2):
        lis.append(i)

Q = int(input())
for q in range(Q):
    l, r = map(int, input().split())
    left_ind = bisect.bisect_left(lis, l)
    right_ind = bisect.bisect_right(lis, r)
    print(right_ind - left_ind)