n = int(eval(input()))

list = [int(i) for i in input().split()]



list_odd = list[::2]

list_even = list[1::2]



def cnt_element(x):

    dict = {}

    for i in x:

        if i not in dict:

            dict[i] = 1

        else:

            dict[i] += 1

    return [(v,k) for k,v in list(dict.items())]



cnt_odd = sorted(cnt_element(list_odd),reverse=True)

cnt_even = sorted(cnt_element(list_even),reverse=True)



#最頻値が同じの場合

if cnt_odd[0][1] == cnt_even[0][1]:

    #リスト内の値が１つの場合

    if len(cnt_odd) ==1 or len(cnt_even) == 1:

        ans =  int(n / 2)

    #リストが２つ以上の場合

    else:

        #第２最頻値の出現数が奇数の方が多い

        if cnt_odd[1][0] > cnt_even[1][0]:

            ans = n - cnt_odd[1][0] - cnt_even[0][0]

        #第二２最頻値の出現数が偶数の方が多い

        elif cnt_odd[1][0] <= cnt_even[1][0]:

            ans = n - cnt_odd[0][0] - cnt_even[1][0]

#最頻値が異なる場合

else:

    ans = n - cnt_odd[0][0] - cnt_even[0][0]



print(ans)
from collections import Counter



n = int(eval(input()))

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



list_o = list[::2]

list_e = list[1::2]



cnt_o = Counter(list_o).most_common(2)

cnt_e = Counter(list_e).most_common(2)



#最頻値が同じ

if cnt_o[0][0] == cnt_e[0][0]:

    #値が1つ

    if len(cnt_o) == 1 and len(cnt_e) ==1:

        print((int(len(list) / 2)))

    elif len(cnt_o) == 1 and len(cnt_e) != 1:

        print((len(list) - cnt_o[0][1] - cnt_e[1][1]))

    elif len(cnt_o) != 1 and len(cnt_e) == 1:

        print((len(list) - cnt_o[0][1] - cnt_e[1][1]))

    else:

        print((min(len(list) - cnt_o[1][1] - cnt_e[0][1], len(list) - cnt_o[0][1] - cnt_e[1][1])))

#最頻値が異なる

elif cnt_o[0][0] != cnt_e[0][0]:

    if len(cnt_o) == 1 and len(cnt_e) ==1:

        print((0))

    else:

        print((len(list) - cnt_o[0][1] - cnt_e[0][1]))

n = int(eval(input()))
list = [int(i) for i in input().split()]
list_odd = list[::2]
list_even = list[1::2]


def cnt_element(x):
    dict = {}
    for i in x:
        if i not in dict:
            dict[i] = 1
        else:
            dict[i] += 1
    return [(v, k) for k, v in list(dict.items())]


cnt_odd = sorted(cnt_element(list_odd), reverse=True)
cnt_even = sorted(cnt_element(list_even), reverse=True)
# 最頻値が同じの場合
if cnt_odd[0][1] == cnt_even[0][1]:
    # リスト内の値が１つの場合
    if len(cnt_odd) == 1 or len(cnt_even) == 1:
        ans = int(n / 2)
    # リストが２つ以上の場合
    else:
        # 第２最頻値の出現数が奇数の方が多い
        if cnt_odd[1][0] > cnt_even[1][0]:
            ans = n - cnt_odd[1][0] - cnt_even[0][0]
        # 第二２最頻値の出現数が偶数の方が多い
        elif cnt_odd[1][0] <= cnt_even[1][0]:
            ans = n - cnt_odd[0][0] - cnt_even[1][0]
# 最頻値が異なる場合
else:
    ans = n - cnt_odd[0][0] - cnt_even[0][0]
print(ans)

from collections import Counter

n = int(eval(input()))
list = list(map(int, input().split()))
list_o = list[::2]
list_e = list[1::2]
cnt_o = Counter(list_o).most_common(2)
cnt_e = Counter(list_e).most_common(2)
# 最頻値が同じ
if cnt_o[0][0] == cnt_e[0][0]:
    # 値が1つ
    if len(cnt_o) == 1 and len(cnt_e) == 1:
        print((int(len(list) / 2)))
    elif len(cnt_o) == 1 and len(cnt_e) != 1:
        print((len(list) - cnt_o[0][1] - cnt_e[1][1]))
    elif len(cnt_o) != 1 and len(cnt_e) == 1:
        print((len(list) - cnt_o[0][1] - cnt_e[1][1]))
    else:
        print(
            (
                min(
                    len(list) - cnt_o[1][1] - cnt_e[0][1],
                    len(list) - cnt_o[0][1] - cnt_e[1][1],
                )
            )
        )
# 最頻値が異なる
elif cnt_o[0][0] != cnt_e[0][0]:
    if len(cnt_o) == 1 and len(cnt_e) == 1:
        print((0))
    else:
        print((len(list) - cnt_o[0][1] - cnt_e[0][1]))

+from collections import Counter + -list = [int(i) for i in input().split()] -list_odd = list[::2] -list_even = list[1::2] - - -def cnt_element(x): -    dict = {} -    for i in x: -        if i not in dict: -            dict[i] = 1 -        else: -            dict[i] += 1 -    return [(v, k) for k, v in list(dict.items())] - - -cnt_odd = sorted(cnt_element(list_odd), reverse=True) -cnt_even = sorted(cnt_element(list_even), reverse=True) -# 最頻値が同じの場合 -if cnt_odd[0][1] == cnt_even[0][1]: -    # リスト内の値が１つの場合 -    if len(cnt_odd) == 1 or len(cnt_even) == 1: -        ans = int(n / 2) -    # リストが２つ以上の場合 +list = list(map(int, input().split())) +list_o = list[::2] +list_e = list[1::2] +cnt_o = Counter(list_o).most_common(2) +cnt_e = Counter(list_e).most_common(2) +# 最頻値が同じ +if cnt_o[0][0] == cnt_e[0][0]: +    # 値が1つ +    if len(cnt_o) == 1 and len(cnt_e) == 1: +        print((int(len(list) / 2))) +    elif len(cnt_o) == 1 and len(cnt_e) != 1: +        print((len(list) - cnt_o[0][1] - cnt_e[1][1])) +    elif len(cnt_o) != 1 and len(cnt_e) == 1: +        print((len(list) - cnt_o[0][1] - cnt_e[1][1])) -        # 第２最頻値の出現数が奇数の方が多い -        if cnt_odd[1][0] > cnt_even[1][0]: -            ans = n - cnt_odd[1][0] - cnt_even[0][0] -        # 第二２最頻値の出現数が偶数の方が多い -        elif cnt_odd[1][0] <= cnt_even[1][0]: -            ans = n - cnt_odd[0][0] - cnt_even[1][0] -# 最頻値が異なる場合 -else: -    ans = n - cnt_odd[0][0] - cnt_even[0][0] -print(ans) +        print( +            ( +                min( +                    len(list) - cnt_o[1][1] - cnt_e[0][1], +                    len(list) - cnt_o[0][1] - cnt_e[1][1], +                ) +            ) +        ) +# 最頻値が異なる +elif cnt_o[0][0] != cnt_e[0][0]: +    if len(cnt_o) == 1 and len(cnt_e) == 1: +        print((0)) +    else: +        print((len(list) - cnt_o[0][1] - cnt_e[0][1]))