Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

former = []
latter = []
counter = 0
for node in v:
    if(counter % 2 == 0):
        former.append(node)
    else:
        latter.append(node)
    counter += 1

forlen = len(former)
latlen = len(latter)

forfreq = [0] * forlen
latfreq = [0] * latlen

for i in range(forlen):
    for j in range(forlen):
        if(former[i] == former[j]):
            forfreq[i] += 1

for i in range(latlen):
    for j in range(latlen):
        if(latter[i] == latter[j]):
            latfreq[i] += 1

forfreqidx = 0
latfreqidx = 0

for i in range(forlen):
    if(forfreq[i] > forfreq[forfreqidx]):
        forfreqidx = i

for i in range(latlen):
    if(latfreq[i] > latfreq[latfreqidx]):
        latfreqidx = i

if(former[forfreqidx] == latter[latfreqidx]):
    for1st = forfreq[forfreqidx]
    forfreq[forfreqidx] = 0

    forfreqidx2 = 0
    for i in range(forlen):
        if (forfreq[i] > forfreq[forfreqidx2]):
            forfreqidx2 = i

    for2nd = forfreq[forfreqidx2]

    lat1st = latfreq[latfreqidx]
    latfreq[latfreqidx] = 0

    latfreqidx2 = 0
    for i in range(latlen):
        if (latfreq[i] > latfreq[latfreqidx2]):
            latfreqidx2 = i

    lat2nd = latfreq[latfreqidx2]

    if(for1st - for2nd >= lat1st - lat2nd):
        latfreqidx = latfreqidx2
    else:
        forfreqidx = forfreqidx2


# 最頻値の出現回数
forval = forfreq[forfreqidx]
latval = latfreq[latfreqidx]

print((forlen - forval) + (latlen - latval))

Fixed submission:
# -*- coding: utf-8 -*-

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

former = []
latter = []
counter = 0
for node in v:
    if(counter % 2 == 0):
        former.append(node)
    else:
        latter.append(node)
    counter += 1

forlen = len(former)
latlen = len(latter)

forfreq = [0] * forlen
latfreq = [0] * latlen

former_sorted = sorted(former)
latter_sorted = sorted(latter)

# 最頻値を求める
counter = 0
for_val_num = []
next_idx = 0
for i in range(forlen):
    if(former_sorted[i] == former_sorted[next_idx]):
        counter += 1
    else:
        for_val_num.append([former_sorted[next_idx], counter])
        next_idx = i
        counter = 1
    if (i == forlen - 1):
        for_val_num.append([former_sorted[next_idx], counter])

forfreqidx1 = 0

for i in range(len(for_val_num)):
    if(for_val_num[i][1] > for_val_num[forfreqidx1][1]):
        forfreqidx1 = i

# 第1位最頻値の出現回数
forfreqnum1 = for_val_num[forfreqidx1][1]

# 最頻値を求める
counter = 0
lat_val_num = []
next_idx = 0
for i in range(latlen):
    if(latter_sorted[i] == latter_sorted[next_idx]):
        counter += 1
    else:
        lat_val_num.append([latter_sorted[next_idx], counter])
        next_idx = i
        counter = 1
    if (i == latlen - 1):
        lat_val_num.append([latter_sorted[next_idx], counter])

latfreqidx1 = 0

for i in range(len(lat_val_num)):
    if(lat_val_num[i][1] > lat_val_num[latfreqidx1][1]):
        latfreqidx1 = i

# 第1位最頻値の出現回数
latfreqnum1 = lat_val_num[latfreqidx1][1]

# 同じ数だった時
if(for_val_num[forfreqidx1][0] == lat_val_num[latfreqidx1][0]):
    # 第1位最頻値の出現回数を0にする
    for_val_num[forfreqidx1][1] = 0
    lat_val_num[latfreqidx1][1] = 0

    forfreqidx2 = 0

    for i in range(len(for_val_num)):
        if (for_val_num[i][1] > for_val_num[forfreqidx2][1]):
            forfreqidx2 = i

    # 第2位最頻値の出現回数
    forfreqnum2 = for_val_num[forfreqidx2][1]

    latfreqidx2 = 0

    for i in range(len(lat_val_num)):
        if (lat_val_num[i][1] > lat_val_num[latfreqidx2][1]):
            latfreqidx2 = i

    # 第1位最頻値の出現回数
    latfreqnum2 = lat_val_num[latfreqidx2][1]

    if(forfreqnum1 - forfreqnum2 >= latfreqnum1 - latfreqnum2):
        print((forlen - forfreqnum1) + (latlen - latfreqnum2))
    else:
        print((forlen - forfreqnum2) + (latlen - latfreqnum1))
else:
    print((forlen - forfreqnum1) + (latlen - latfreqnum1))