Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+100)]
cc = [0 for i in range(pow(10,5)+100)]
for i in range(len(b)):
    if i % 2 == 0:
        cc[b[i]-1] += 1
    else:
        c[b[i]-1] += 1

one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(len(c)+10):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i

t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)


Fixed submission:
from collections import Counter

a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+1)]
cc = [0 for i in range(pow(10,5)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1
first = Counter(b[::2]).most_common(2) + [(0, 0)]
latter = Counter(b[1::2]).most_common(2) + [(0, 0)]
one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    elif onee <= c[i]:
        onee = c[i]
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i
    elif twoo <= cc[i]:
        twoo = cc[i]
t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)

Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+1)]
cc = [0 for i in range(pow(10,5)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        c[b[i]-1] += 1
    else:
        cc[b[i]-1] += 1

one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i

t = max(one+twoo,onee+twso)

if k != kk:
    print(a-one-two)
else:
    print(a-t)

Fixed submission:
from collections import Counter

a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+1)]
cc = [0 for i in range(pow(10,5)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1
first = Counter(b[::2]).most_common(2) + [(0, 0)]
latter = Counter(b[1::2]).most_common(2) + [(0, 0)]
one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    elif onee <= c[i]:
        onee = c[i]
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i
    elif twoo <= cc[i]:
        twoo = cc[i]
t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)

Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5))]
cc = [0 for i in range(pow(10,5))]
for i in range(a):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1

one = 0
onee = 0
two = 0
twoo = 0
p = 0
pp = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        p += 1
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        p += 1
    if p == 2:
        pp = 1
    else:
        pp = 0
    p = 0

t = max(one+twoo,onee+two)

if pp == 0:
    print(a-one-two)
else:
    print(a-t)

Fixed submission:
from collections import Counter

a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+1)]
cc = [0 for i in range(pow(10,5)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1
first = Counter(b[::2]).most_common(2) + [(0, 0)]
latter = Counter(b[1::2]).most_common(2) + [(0, 0)]
one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    elif onee <= c[i]:
        onee = c[i]
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i
    elif twoo <= cc[i]:
        twoo = cc[i]
t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)

Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5))]
cc = [0 for i in range(pow(10,5))]
for i in range(a):
    if i % 2 == 0:
        c[b[i]-1] += 1
    else:
        cc[b[i]-1] += 1

one = 0
onee = 0
two = 0
twoo = 0
p = 0
pp = 0
for i in range(d):
    if one < c[i]:
        onee = one
        one = c[i]
        p += 1
    if two < cc[i]:
        twoo = two
        two = cc[i]
        p += 1
    if p == 2
        pp = 1
    else:
        pp = 0
    p = 0

t = max(one+twoo,onee+two)

if pp == 0
    print(a-one-two)
else:
    print(a-t)


Fixed submission:
from collections import Counter

a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+1)]
cc = [0 for i in range(pow(10,5)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1
first = Counter(b[::2]).most_common(2) + [(0, 0)]
latter = Counter(b[1::2]).most_common(2) + [(0, 0)]
one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    elif onee <= c[i]:
        onee = c[i]
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i
    elif twoo <= cc[i]:
        twoo = cc[i]
t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)

Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5))]

for i in range(a):
    c[b[i]-1] += 1

one = max(c[0],c[1])
two = min(c[0],c[1])

for i in range(d):
    if c[i+2] >= one:
        two = one
        one = c[i+2]

print(a-one-two)

Fixed submission:
from collections import Counter

a = int(input())

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+1)]
cc = [0 for i in range(pow(10,5)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1
first = Counter(b[::2]).most_common(2) + [(0, 0)]
latter = Counter(b[1::2]).most_common(2) + [(0, 0)]
one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(d+1):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    elif onee <= c[i]:
        onee = c[i]
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i
    elif twoo <= cc[i]:
        twoo = cc[i]
t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)