n = int(eval(input()))

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

odd = {}

even = {}

change = 0

for i in range(n):

    if i % 2 == 0:

        if v[i] in even:

            even[v[i]] += 1

        else:

            even[v[i]] = 1

    else:

        if v[i] in odd:

            odd[v[i]] += 1

        else:

            odd[v[i]] = 1



if len(odd) == 1 and len(even) == 1:

    if odd == even:

        change = int(n / 2)

else:

    max_e = max(even, key=even.get)

    max_o = max(odd, key=odd.get)

    if max_e != max_o:

        change = n - even[max_e] - odd[max_o]

    else:

        if even[max_e] > even[max_o]:

            max_o2 = min(odd, key=odd.get)

            for o in odd:

                if o != max_o and odd[o] > odd[max_o2]:

                    max_o2 = o

            change = n - even[max_e] - odd[max_o2]

        elif even[max_e] == even[max_o]:

            max_o2 = min(odd, key=odd.get)

            for o in odd:

                if o != max_o and odd[o] > odd[max_o2]:

                    max_o2 = o

            max_e2 = min(even, key=even.get)

            for e in even:

                if e != max_e and even[e] > even[max_e2]:

                    max_e2 = e

            change = min(n - even[max_e] - odd[max_o2], n - odd[max_o] - even[max_e2])

        else:

            max_e2 = min(even, key=even.get)

            for e in even:

                if e != max_e and even[e] > even[max_e2]:

                    max_e2 = e

            change = n - odd[max_o] - even[max_e2]

print(change)
from collections import Counter

n = int(eval(input()))

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

c1 = Counter(v[::2])

c2 = Counter(v[1::2])

s1 = sorted(list(c1.items()), key=lambda x:x[1], reverse=True)

s2 = sorted(list(c2.items()), key=lambda x:x[1], reverse=True)



if len(s1) == 1 and len(s2) == 1:

    if s1[0][0] == s2[0][0]:

        ans = int(n / 2)

    else:

        ans = 0

else:

    if s1[0][0] != s2[0][0]:

        ans = n - s1[0][1] - s2[0][1]

    else:

        if s1[0][1] > s2[0][1]:

            ans = n - s1[0][1] - s2[1][1]

        elif s1[0][1] < s2[0][1]:

            ans = n - s1[1][1] - s2[0][1]

        else:

            ans = min(n - s1[0][1] - s2[1][1], n - s1[1][1] - s2[0][1])

print(ans)
n = int(eval(input()))
v = list(map(int, input().split()))
odd = {}
even = {}
change = 0
for i in range(n):
    if i % 2 == 0:
        if v[i] in even:
            even[v[i]] += 1
        else:
            even[v[i]] = 1
    else:
        if v[i] in odd:
            odd[v[i]] += 1
        else:
            odd[v[i]] = 1
if len(odd) == 1 and len(even) == 1:
    if odd == even:
        change = int(n / 2)
else:
    max_e = max(even, key=even.get)
    max_o = max(odd, key=odd.get)
    if max_e != max_o:
        change = n - even[max_e] - odd[max_o]
    else:
        if even[max_e] > even[max_o]:
            max_o2 = min(odd, key=odd.get)
            for o in odd:
                if o != max_o and odd[o] > odd[max_o2]:
                    max_o2 = o
            change = n - even[max_e] - odd[max_o2]
        elif even[max_e] == even[max_o]:
            max_o2 = min(odd, key=odd.get)
            for o in odd:
                if o != max_o and odd[o] > odd[max_o2]:
                    max_o2 = o
            max_e2 = min(even, key=even.get)
            for e in even:
                if e != max_e and even[e] > even[max_e2]:
                    max_e2 = e
            change = min(n - even[max_e] - odd[max_o2], n - odd[max_o] - even[max_e2])
        else:
            max_e2 = min(even, key=even.get)
            for e in even:
                if e != max_e and even[e] > even[max_e2]:
                    max_e2 = e
            change = n - odd[max_o] - even[max_e2]
print(change)

from collections import Counter

n = int(eval(input()))
v = list(map(int, input().split()))
c1 = Counter(v[::2])
c2 = Counter(v[1::2])
s1 = sorted(list(c1.items()), key=lambda x: x[1], reverse=True)
s2 = sorted(list(c2.items()), key=lambda x: x[1], reverse=True)
if len(s1) == 1 and len(s2) == 1:
    if s1[0][0] == s2[0][0]:
        ans = int(n / 2)
    else:
        ans = 0
else:
    if s1[0][0] != s2[0][0]:
        ans = n - s1[0][1] - s2[0][1]
    else:
        if s1[0][1] > s2[0][1]:
            ans = n - s1[0][1] - s2[1][1]
        elif s1[0][1] < s2[0][1]:
            ans = n - s1[1][1] - s2[0][1]
        else:
            ans = min(n - s1[0][1] - s2[1][1], n - s1[1][1] - s2[0][1])
print(ans)

+from collections import Counter + -odd = {} -even = {} -change = 0 -for i in range(n): -    if i % 2 == 0: -        if v[i] in even: -            even[v[i]] += 1 +c1 = Counter(v[::2]) +c2 = Counter(v[1::2]) +s1 = sorted(list(c1.items()), key=lambda x: x[1], reverse=True) +s2 = sorted(list(c2.items()), key=lambda x: x[1], reverse=True) +if len(s1) == 1 and len(s2) == 1: +    if s1[0][0] == s2[0][0]: +        ans = int(n / 2) +    else: +        ans = 0 +else: +    if s1[0][0] != s2[0][0]: +        ans = n - s1[0][1] - s2[0][1] +    else: +        if s1[0][1] > s2[0][1]: +            ans = n - s1[0][1] - s2[1][1] +        elif s1[0][1] < s2[0][1]: +            ans = n - s1[1][1] - s2[0][1] -            even[v[i]] = 1 -    else: -        if v[i] in odd: -            odd[v[i]] += 1 -        else: -            odd[v[i]] = 1 -if len(odd) == 1 and len(even) == 1: -    if odd == even: -        change = int(n / 2) -else: -    max_e = max(even, key=even.get) -    max_o = max(odd, key=odd.get) -    if max_e != max_o: -        change = n - even[max_e] - odd[max_o] -    else: -        if even[max_e] > even[max_o]: -            max_o2 = min(odd, key=odd.get) -            for o in odd: -                if o != max_o and odd[o] > odd[max_o2]: -                    max_o2 = o -            change = n - even[max_e] - odd[max_o2] -        elif even[max_e] == even[max_o]: -            max_o2 = min(odd, key=odd.get) -            for o in odd: -                if o != max_o and odd[o] > odd[max_o2]: -                    max_o2 = o -            max_e2 = min(even, key=even.get) -            for e in even: -                if e != max_e and even[e] > even[max_e2]: -                    max_e2 = e -            change = min(n - even[max_e] - odd[max_o2], n - odd[max_o] - even[max_e2]) -        else: -            max_e2 = min(even, key=even.get) -            for e in even: -                if e != max_e and even[e] > even[max_e2]: -                    max_e2 = e -            change = n - odd[max_o] - even[max_e2] -print(change) +            ans = min(n - s1[0][1] - s2[1][1], n - s1[1][1] - s2[0][1]) +print(ans)