from collections import Counter





def main():

  n = int(eval(input()))

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

  lst1, lst2 = list(zip(*list(zip(m, m))))

  c1, c2 = sorted(list(Counter(lst1).items()), key=lambda x: x[1], reverse=1), sorted(list(Counter(lst2).items()), key=lambda x: x[1], reverse=1)

  c1.append((0, 0)), c2.append((0, 0))

  if c1[0][0] != c2[0][0]:

    print((n - c1[0][1] - c2[0][1]))

  else:

    print((n - max(c1[1][1] + c2[0][1], c1[0][1] + c2[1][1])))





if __name__ == '__main__':

  main()
from collections import Counter





def main():

  n, *lst = list(map(int, open(0).read().split()))

  c1, c2 = sorted(list(Counter(lst[::2]).items()), key=lambda x: x[1], reverse=1), sorted(list(Counter(lst[1::2]).items()), key=lambda x: x[1], reverse=1)

  c1.append((0, 0)), c2.append((0, 0))

  if c1[0][0] != c2[0][0]:

    print((n - c1[0][1] - c2[0][1]))

  else:

    print((n - max(c1[1][1] + c2[0][1], c1[0][1] + c2[1][1])))





if __name__ == '__main__':

  main()
from collections import Counter


def main():
    n = int(eval(input()))
    m = list(map(int, input().split()))
    lst1, lst2 = list(zip(*list(zip(m, m))))
    c1, c2 = sorted(list(Counter(lst1).items()), key=lambda x: x[1], reverse=1), sorted(
        list(Counter(lst2).items()), key=lambda x: x[1], reverse=1
    )
    c1.append((0, 0)), c2.append((0, 0))
    if c1[0][0] != c2[0][0]:
        print((n - c1[0][1] - c2[0][1]))
    else:
        print((n - max(c1[1][1] + c2[0][1], c1[0][1] + c2[1][1])))


if __name__ == "__main__":
    main()

from collections import Counter


def main():
    n, *lst = list(map(int, open(0).read().split()))
    c1, c2 = sorted(
        list(Counter(lst[::2]).items()), key=lambda x: x[1], reverse=1
    ), sorted(list(Counter(lst[1::2]).items()), key=lambda x: x[1], reverse=1)
    c1.append((0, 0)), c2.append((0, 0))
    if c1[0][0] != c2[0][0]:
        print((n - c1[0][1] - c2[0][1]))
    else:
        print((n - max(c1[1][1] + c2[0][1], c1[0][1] + c2[1][1])))


if __name__ == "__main__":
    main()

-    n = int(eval(input())) -    m = list(map(int, input().split())) -    lst1, lst2 = list(zip(*list(zip(m, m)))) -    c1, c2 = sorted(list(Counter(lst1).items()), key=lambda x: x[1], reverse=1), sorted( -        list(Counter(lst2).items()), key=lambda x: x[1], reverse=1 -    ) +    n, *lst = list(map(int, open(0).read().split())) +    c1, c2 = sorted( +        list(Counter(lst[::2]).items()), key=lambda x: x[1], reverse=1 +    ), sorted(list(Counter(lst[1::2]).items()), key=lambda x: x[1], reverse=1)