n = int(eval(input()))

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



app = {}

for i, j in zip(v[::2], v[1::2]):

    if i not in app:

        app[i] = [1, 0]

    else:

        app[i][0] += 1

    if j not in app:

        app[j] = [0, 1]

    else:

        app[j][1] += 1



max_o = [0, 0]

secmax_o = [0, 0]

max_e = [0, 0]

secmax_e = [0, 0]

for i in app:

    if app[i][0] > max_o[1]:

        secmax_o = max_o[:]

        max_o = [i, app[i][0]]

    elif app[i][0] > secmax_o[1]:

        secmax_o = [i, app[i][0]]

    if app[i][1] > max_e[1]:

        secmax_e = max_e[:]

        max_e = [i, app[i][1]]

    elif app[i][1] > secmax_e[1]:

        secmax_e = [i, app[i][1]]



if max_o[0] != max_e[0]:

    print((n - max_o[1] - max_e[1]))

else:

    del0 = max_o[1] - secmax_o[1]

    del1 = max_e[1] - secmax_e[1]

    print((n + min(del0, del1) - max_o[1] - max_e[1]))
from collections import Counter



n = int(eval(input()))

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

cnt_o = Counter(v[::2]).most_common(2)

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

cnt_o.append((0, 0))

cnt_e.append((0, 0))



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

    print((n - cnt_o[0][1] - cnt_e[0][1]))

else:

    del1 = cnt_o[0][1] - cnt_o[1][1]

    del2 = cnt_e[0][1] - cnt_e[1][1]

    print((n - cnt_o[0][1] - cnt_e[0][1] + min(del1, del2)))
n = int(eval(input()))
v = list(map(int, input().split()))
app = {}
for i, j in zip(v[::2], v[1::2]):
    if i not in app:
        app[i] = [1, 0]
    else:
        app[i][0] += 1
    if j not in app:
        app[j] = [0, 1]
    else:
        app[j][1] += 1
max_o = [0, 0]
secmax_o = [0, 0]
max_e = [0, 0]
secmax_e = [0, 0]
for i in app:
    if app[i][0] > max_o[1]:
        secmax_o = max_o[:]
        max_o = [i, app[i][0]]
    elif app[i][0] > secmax_o[1]:
        secmax_o = [i, app[i][0]]
    if app[i][1] > max_e[1]:
        secmax_e = max_e[:]
        max_e = [i, app[i][1]]
    elif app[i][1] > secmax_e[1]:
        secmax_e = [i, app[i][1]]
if max_o[0] != max_e[0]:
    print((n - max_o[1] - max_e[1]))
else:
    del0 = max_o[1] - secmax_o[1]
    del1 = max_e[1] - secmax_e[1]
    print((n + min(del0, del1) - max_o[1] - max_e[1]))

from collections import Counter

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

+from collections import Counter + -app = {} -for i, j in zip(v[::2], v[1::2]): -    if i not in app: -        app[i] = [1, 0] -    else: -        app[i][0] += 1 -    if j not in app: -        app[j] = [0, 1] -    else: -        app[j][1] += 1 -max_o = [0, 0] -secmax_o = [0, 0] -max_e = [0, 0] -secmax_e = [0, 0] -for i in app: -    if app[i][0] > max_o[1]: -        secmax_o = max_o[:] -        max_o = [i, app[i][0]] -    elif app[i][0] > secmax_o[1]: -        secmax_o = [i, app[i][0]] -    if app[i][1] > max_e[1]: -        secmax_e = max_e[:] -        max_e = [i, app[i][1]] -    elif app[i][1] > secmax_e[1]: -        secmax_e = [i, app[i][1]] -if max_o[0] != max_e[0]: -    print((n - max_o[1] - max_e[1])) +cnt_o = Counter(v[::2]).most_common(2) +cnt_e = Counter(v[1::2]).most_common(2) +cnt_o.append((0, 0)) +cnt_e.append((0, 0)) +if cnt_o[0][0] != cnt_e[0][0]: +    print((n - cnt_o[0][1] - cnt_e[0][1])) -    del0 = max_o[1] - secmax_o[1] -    del1 = max_e[1] - secmax_e[1] -    print((n + min(del0, del1) - max_o[1] - max_e[1])) +    del1 = cnt_o[0][1] - cnt_o[1][1] +    del2 = cnt_e[0][1] - cnt_e[1][1] +    print((n - cnt_o[0][1] - cnt_e[0][1] + min(del1, del2)))