import sys

import numpy as np

input = sys.stdin.readline



def main():

    n = int(eval(input()))

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



    len1 = n//2 + n&1

    len2 = n//2



    d1 = {0:0}

    d2 = {0:0}

    for i in range(0,n,2):

        if v[i] in d1:

            d1[v[i]] += 1

        else:

            d1[v[i]] = 1

    for i in range(1,n,2):

        if v[i] in d2:

            d2[v[i]] += 1

        else:

            d2[v[i]] = 1



    a = sorted(list(d1.items()), key = lambda x: (x[1], x[0]) , reverse=True)

    b = sorted(list(d2.items()), key = lambda x: (x[1], -x[0]), reverse=True)

    a1_key, a1_val = a[0]

    a2_key, a2_val = a[1]

    b1_key, b1_val = b[0]

    b2_key, b2_val = b[1]

    if a1_key != b1_key:

        print((n - a1_val - b1_val))

    else:

        print((min(n - a1_val - b2_val, n - a2_val - b1_val)))







if __name__ == "__main__":

    main()

def main():

    n = int(eval(input()))

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



    dic1 = {0:0}

    for i in range(0, n, 2):

        if v[i] in dic1:

            dic1[v[i]] += 1

        else:

            dic1[v[i]] = 1

    

    dic2 = {0:0}

    for i in range(1, n, 2):

        if v[i] in dic2:

            dic2[v[i]] += 1

        else:

            dic2[v[i]] = 1

    

    dic1 = sorted(list(dic1.items()), key=lambda x: -x[1])

    dic2 = sorted(list(dic2.items()), key=lambda x: -x[1])

    # print(dic1)

    # print(dic2)

    if dic1[0][0] != dic2[0][0]:

        print((n-dic1[0][1]-dic2[0][1]))

    else:

        print((min(n-dic1[0][1]-dic2[1][1], n-dic1[1][1]-dic2[0][1])))



if __name__ == "__main__":

    main()
import sys
import numpy as np

input = sys.stdin.readline


def main():
    n = int(eval(input()))
    v = np.array(list(map(int, input().split())))
    len1 = n // 2 + n & 1
    len2 = n // 2
    d1 = {0: 0}
    d2 = {0: 0}
    for i in range(0, n, 2):
        if v[i] in d1:
            d1[v[i]] += 1
        else:
            d1[v[i]] = 1
    for i in range(1, n, 2):
        if v[i] in d2:
            d2[v[i]] += 1
        else:
            d2[v[i]] = 1
    a = sorted(list(d1.items()), key=lambda x: (x[1], x[0]), reverse=True)
    b = sorted(list(d2.items()), key=lambda x: (x[1], -x[0]), reverse=True)
    a1_key, a1_val = a[0]
    a2_key, a2_val = a[1]
    b1_key, b1_val = b[0]
    b2_key, b2_val = b[1]
    if a1_key != b1_key:
        print((n - a1_val - b1_val))
    else:
        print((min(n - a1_val - b2_val, n - a2_val - b1_val)))


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    v = list(map(int, input().split()))
    dic1 = {0: 0}
    for i in range(0, n, 2):
        if v[i] in dic1:
            dic1[v[i]] += 1
        else:
            dic1[v[i]] = 1
    dic2 = {0: 0}
    for i in range(1, n, 2):
        if v[i] in dic2:
            dic2[v[i]] += 1
        else:
            dic2[v[i]] = 1
    dic1 = sorted(list(dic1.items()), key=lambda x: -x[1])
    dic2 = sorted(list(dic2.items()), key=lambda x: -x[1])
    # print(dic1)
    # print(dic2)
    if dic1[0][0] != dic2[0][0]:
        print((n - dic1[0][1] - dic2[0][1]))
    else:
        print((min(n - dic1[0][1] - dic2[1][1], n - dic1[1][1] - dic2[0][1])))


if __name__ == "__main__":
    main()

-import sys -import numpy as np - -input = sys.stdin.readline - - -    v = np.array(list(map(int, input().split()))) -    len1 = n // 2 + n & 1 -    len2 = n // 2 -    d1 = {0: 0} -    d2 = {0: 0} +    v = list(map(int, input().split())) +    dic1 = {0: 0} -        if v[i] in d1: -            d1[v[i]] += 1 +        if v[i] in dic1: +            dic1[v[i]] += 1 -            d1[v[i]] = 1 +            dic1[v[i]] = 1 +    dic2 = {0: 0} -        if v[i] in d2: -            d2[v[i]] += 1 +        if v[i] in dic2: +            dic2[v[i]] += 1 -            d2[v[i]] = 1 -    a = sorted(list(d1.items()), key=lambda x: (x[1], x[0]), reverse=True) -    b = sorted(list(d2.items()), key=lambda x: (x[1], -x[0]), reverse=True) -    a1_key, a1_val = a[0] -    a2_key, a2_val = a[1] -    b1_key, b1_val = b[0] -    b2_key, b2_val = b[1] -    if a1_key != b1_key: -        print((n - a1_val - b1_val)) +            dic2[v[i]] = 1 +    dic1 = sorted(list(dic1.items()), key=lambda x: -x[1]) +    dic2 = sorted(list(dic2.items()), key=lambda x: -x[1]) +    # print(dic1) +    # print(dic2) +    if dic1[0][0] != dic2[0][0]: +        print((n - dic1[0][1] - dic2[0][1])) -        print((min(n - a1_val - b2_val, n - a2_val - b1_val))) +        print((min(n - dic1[0][1] - dic2[1][1], n - dic1[1][1] - dic2[0][1])))