import numpy as np

n = int(eval(input()))

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

v_odd = []

v_even = []

for i in range(n):

  if i%2 == 0:

    v_odd.append(v[i])

  else:

    v_even.append(v[i])



vs_odd = np.array(v_odd)

vs_even = np.array(v_even)

count_odd = np.bincount(vs_odd)

count_even = np.bincount(vs_even)

mode_odd = np.argmax(count_odd)

mode_even = np.argmax(count_even)

a = v_odd.count(mode_odd)

b = v_even.count(mode_even)

if mode_odd != mode_even:

  print((n-a-b))

else:

  if len(v_odd) != v_odd.count(mode_odd):

    v_odd2 = [i for i in v_odd if i != mode_odd]

    vs_odd2 = np.array(v_odd2)

    count_odd2 = np.bincount(vs_odd2)

    mode_odd2 = np.argmax(count_odd2)

    a2 = v_odd.count(mode_odd2)

  else:

    a2 = 0

  if len(v_even) != v_even.count(mode_even):

    v_even2 = [i for i in v_even if i != mode_even]

    vs_even2 = np.array(v_even2)

    count_even2 = np.bincount(vs_even2)

    mode_even2 = np.argmax(count_even2)

    b2 = v_even.count(mode_even2)

  else:

    b2 = 0

  if a2 > b2:

    print((n-a2-b))

  else:

    print((n-a-b2))
from collections import Counter

n=int(eval(input()))

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

a=Counter(v[0::2]).most_common()

b=Counter(v[1::2]).most_common()

a.append([0,0])

b.append([0,0])

if a[0][0]!=b[0][0]:

    print((n-(a[0][1]+b[0][1])))

else:

    print((min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1]))))
import numpy as np

n = int(eval(input()))
v = list(map(int, input().split()))
v_odd = []
v_even = []
for i in range(n):
    if i % 2 == 0:
        v_odd.append(v[i])
    else:
        v_even.append(v[i])
vs_odd = np.array(v_odd)
vs_even = np.array(v_even)
count_odd = np.bincount(vs_odd)
count_even = np.bincount(vs_even)
mode_odd = np.argmax(count_odd)
mode_even = np.argmax(count_even)
a = v_odd.count(mode_odd)
b = v_even.count(mode_even)
if mode_odd != mode_even:
    print((n - a - b))
else:
    if len(v_odd) != v_odd.count(mode_odd):
        v_odd2 = [i for i in v_odd if i != mode_odd]
        vs_odd2 = np.array(v_odd2)
        count_odd2 = np.bincount(vs_odd2)
        mode_odd2 = np.argmax(count_odd2)
        a2 = v_odd.count(mode_odd2)
    else:
        a2 = 0
    if len(v_even) != v_even.count(mode_even):
        v_even2 = [i for i in v_even if i != mode_even]
        vs_even2 = np.array(v_even2)
        count_even2 = np.bincount(vs_even2)
        mode_even2 = np.argmax(count_even2)
        b2 = v_even.count(mode_even2)
    else:
        b2 = 0
    if a2 > b2:
        print((n - a2 - b))
    else:
        print((n - a - b2))

from collections import Counter

n = int(eval(input()))
v = list(map(int, input().split()))
a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0, 0])
b.append([0, 0])
if a[0][0] != b[0][0]:
    print((n - (a[0][1] + b[0][1])))
else:
    print((min(n - (a[1][1] + b[0][1]), n - (a[0][1] + b[1][1]))))

-import numpy as np +from collections import Counter -v_odd = [] -v_even = [] -for i in range(n): -    if i % 2 == 0: -        v_odd.append(v[i]) -    else: -        v_even.append(v[i]) -vs_odd = np.array(v_odd) -vs_even = np.array(v_even) -count_odd = np.bincount(vs_odd) -count_even = np.bincount(vs_even) -mode_odd = np.argmax(count_odd) -mode_even = np.argmax(count_even) -a = v_odd.count(mode_odd) -b = v_even.count(mode_even) -if mode_odd != mode_even: -    print((n - a - b)) +a = Counter(v[0::2]).most_common() +b = Counter(v[1::2]).most_common() +a.append([0, 0]) +b.append([0, 0]) +if a[0][0] != b[0][0]: +    print((n - (a[0][1] + b[0][1]))) -    if len(v_odd) != v_odd.count(mode_odd): -        v_odd2 = [i for i in v_odd if i != mode_odd] -        vs_odd2 = np.array(v_odd2) -        count_odd2 = np.bincount(vs_odd2) -        mode_odd2 = np.argmax(count_odd2) -        a2 = v_odd.count(mode_odd2) -    else: -        a2 = 0 -    if len(v_even) != v_even.count(mode_even): -        v_even2 = [i for i in v_even if i != mode_even] -        vs_even2 = np.array(v_even2) -        count_even2 = np.bincount(vs_even2) -        mode_even2 = np.argmax(count_even2) -        b2 = v_even.count(mode_even2) -    else: -        b2 = 0 -    if a2 > b2: -        print((n - a2 - b)) -    else: -        print((n - a - b2)) +    print((min(n - (a[1][1] + b[0][1]), n - (a[0][1] + b[1][1]))))