Buggy python submission (verdict: Runtime Error):
n=int(input())
v = list(map(int,input().split()))

dic0 = [0 for i in range(10**5+1)]
dic1 = [0 for i in range(10**5+1)]
for i in range(n):
    if i%2==0:    
        dic0[v[i]] += 1
    if i%2==1:
        dic1[v[i]] += 1

MX0_1 = max(dic0)
MX1_1 = max(dic1)

li0 = []
li1 = []


for i in range(10**5+1):
    # if dic0[i]>10:
    #     print(i,dic0[i])
    # if dic1[i]>10:
    #     print(i,dic1[i],"\n")
    
    if dic0[i] == MX0_1:
        li0.append(i)
        dic0[i] = 0
    if dic1[i] == MX1_1:
        li1.append(i)
        dic1[i] = 0

# print(li0,li1)
# print(MX0_1,MX0_1)

if len(li0)>=2 or len(li1)>=2:
    print(n-MX0_1-MX1_1)
elif li0[0] == li1[0]:
    if MX0_1+max(dic1) >= MX1_1+max(dic0):
        print(n-MX0_1-max(dic1))
    else:
        print(n-MX1_1-max(dic0))
        print(1/0)

elif li0[0] != li1[0]:
    print(n-MX0_1-MX1_1)

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

dic0 = [0 for i in range(10**5+1)]
dic1 = [0 for i in range(10**5+1)]
for i in range(n):
    if i%2==0:    
        dic0[v[i]] += 1
    if i%2==1:
        dic1[v[i]] += 1

MX0_1 = max(dic0)
MX1_1 = max(dic1)

li0 = []
li1 = []


for i in range(10**5+1):
    # if dic0[i]>10:
    #     print(i,dic0[i])
    # if dic1[i]>10:
    #     print(i,dic1[i],"\n")
    
    if dic0[i] == MX0_1:
        li0.append(i)
        dic0[i] = 0
    if dic1[i] == MX1_1:
        li1.append(i)
        dic1[i] = 0

# print(li0,li1)
# print(MX0_1,MX0_1)

if len(li0)>=2 or len(li1)>=2:
    print(n-MX0_1-MX1_1)
elif li0[0] == li1[0]:
    print(min(n-MX0_1-max(dic1), n-MX1_1-max(dic0)))
elif li0[0] != li1[0]:
    print(n-MX0_1-MX1_1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
v = list(map(int,input().split()))

dic0 = [0 for i in range(10**5+1)]
dic1 = [0 for i in range(10**5+1)]
for i in range(n):
    if i%2==0:    
        dic0[v[i]] += 1
    if i%2==1:
        dic1[v[i]] += 1

MX0_1 = max(dic0)
MX1_1 = max(dic1)

li0 = []
li1 = []


for i in range(10**5+1):
    if dic0[i]>10:
        #print(i,dic0[i])
    if dic1[i]>10:
        #print(i,dic1[i],"\n")
    
    if dic0[i] == MX0_1:
        li0.append(i)
        dic0[i] = 0
    if dic1[i] == MX1_1:
        li1.append(i)
        dic1[i] = 0

# print(li0,li1)
# print(MX0_1,MX0_1)

if len(li0)>=2 or len(li1)>=2:
    print(n-MX0_1-MX1_1)
elif li0[0] == li1[0]:
    if MX0_1+max(dic1) >= MX1_1+max(dic0):
        print(n-MX0_1-max(dic1))
    else:
        print(n-MX1_1-max(dic0))
        print(1/0)

elif li0[0] != li1[0]:
    print(n-MX0_1-MX1_1)

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

dic0 = [0 for i in range(10**5+1)]
dic1 = [0 for i in range(10**5+1)]
for i in range(n):
    if i%2==0:    
        dic0[v[i]] += 1
    if i%2==1:
        dic1[v[i]] += 1

MX0_1 = max(dic0)
MX1_1 = max(dic1)

li0 = []
li1 = []


for i in range(10**5+1):
    # if dic0[i]>10:
    #     print(i,dic0[i])
    # if dic1[i]>10:
    #     print(i,dic1[i],"\n")
    
    if dic0[i] == MX0_1:
        li0.append(i)
        dic0[i] = 0
    if dic1[i] == MX1_1:
        li1.append(i)
        dic1[i] = 0

# print(li0,li1)
# print(MX0_1,MX0_1)

if len(li0)>=2 or len(li1)>=2:
    print(n-MX0_1-MX1_1)
elif li0[0] == li1[0]:
    print(min(n-MX0_1-max(dic1), n-MX1_1-max(dic0)))
elif li0[0] != li1[0]:
    print(n-MX0_1-MX1_1)