from collections import Counter

n = int(eval(input()))

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

if len(set(V)) == 1:

  print((n//2))

else:

  odd = []

  even = []

  for i in range(len(V)):

    if i % 2 == 0:

      even.append(V[i])

    else:

      odd.append(V[i])

  max_even,max_e_count = Counter(even).most_common(1)[0]

  max_odd,max_o_count = Counter(odd).most_common(1)[0]

  if max_even == max_odd:

    sec_even,sec_e_count = Counter(even).most_common(2)[1]

    sec_odd,sec_o_count = Counter(odd).most_common(2)[1]

    even_rank2 = len(odd) - max_o_count + len(even) - sec_e_count

    odd_rank2 = len(odd) - sec_o_count + len(even) - max_e_count

    print((min(even_rank2,odd_rank2)))

  else:

    print((len(odd) - max_o_count + len(even) - max_e_count))
import itertools

from collections import Counter

N = int(eval(input()))

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

even_counter = Counter(V[::2])

odd_counter = Counter(V[1::2])

even_counter[-1] = 0

odd_counter[-1] = 0

even = even_counter.most_common(2)

odd = odd_counter.most_common(2)

ans = N

for (k1,v1),(k2,v2) in itertools.product(even,odd):

  if k1 == k2:

    continue

  ans = min(ans,N - v1 - v2)

print(ans)
from collections import Counter

n = int(eval(input()))
V = list(map(int, input().split()))
if len(set(V)) == 1:
    print((n // 2))
else:
    odd = []
    even = []
    for i in range(len(V)):
        if i % 2 == 0:
            even.append(V[i])
        else:
            odd.append(V[i])
    max_even, max_e_count = Counter(even).most_common(1)[0]
    max_odd, max_o_count = Counter(odd).most_common(1)[0]
    if max_even == max_odd:
        sec_even, sec_e_count = Counter(even).most_common(2)[1]
        sec_odd, sec_o_count = Counter(odd).most_common(2)[1]
        even_rank2 = len(odd) - max_o_count + len(even) - sec_e_count
        odd_rank2 = len(odd) - sec_o_count + len(even) - max_e_count
        print((min(even_rank2, odd_rank2)))
    else:
        print((len(odd) - max_o_count + len(even) - max_e_count))

import itertools
from collections import Counter

N = int(eval(input()))
V = list(map(int, input().split()))
even_counter = Counter(V[::2])
odd_counter = Counter(V[1::2])
even_counter[-1] = 0
odd_counter[-1] = 0
even = even_counter.most_common(2)
odd = odd_counter.most_common(2)
ans = N
for (k1, v1), (k2, v2) in itertools.product(even, odd):
    if k1 == k2:
        continue
    ans = min(ans, N - v1 - v2)
print(ans)

+import itertools -n = int(eval(input())) +N = int(eval(input())) -if len(set(V)) == 1: -    print((n // 2)) -else: -    odd = [] -    even = [] -    for i in range(len(V)): -        if i % 2 == 0: -            even.append(V[i]) -        else: -            odd.append(V[i]) -    max_even, max_e_count = Counter(even).most_common(1)[0] -    max_odd, max_o_count = Counter(odd).most_common(1)[0] -    if max_even == max_odd: -        sec_even, sec_e_count = Counter(even).most_common(2)[1] -        sec_odd, sec_o_count = Counter(odd).most_common(2)[1] -        even_rank2 = len(odd) - max_o_count + len(even) - sec_e_count -        odd_rank2 = len(odd) - sec_o_count + len(even) - max_e_count -        print((min(even_rank2, odd_rank2))) -    else: -        print((len(odd) - max_o_count + len(even) - max_e_count)) +even_counter = Counter(V[::2]) +odd_counter = Counter(V[1::2]) +even_counter[-1] = 0 +odd_counter[-1] = 0 +even = even_counter.most_common(2) +odd = odd_counter.most_common(2) +ans = N +for (k1, v1), (k2, v2) in itertools.product(even, odd): +    if k1 == k2: +        continue +    ans = min(ans, N - v1 - v2) +print(ans)