There is a given sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other.
The first line contains an integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">6</sup>). The second line contains a sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 3).
import sys, math, operator, itertools, collections, heapq, bisect
# sys.setrecursionlimit(10**4)


class Solution:
    def __init__(self):
        pass

    def solve(self, *Input):
        cnt = collections.Counter(Input[0])
        print(min(cnt[1]+cnt[2],cnt[2]+cnt[3],cnt[3]+cnt[1]))

    def create(self, *Input):
        n,colors = Input
        color_set = set()
        tree = [set()]
        for i in range(1,n+1):
            color_set.add(colors[i-1])
            tree.append(color_set - tree[i & (i-1)])
        return tree

    def check(self, *Input):
        k,matrix = Input
        cnt = 0
        for row in matrix:
            cnt += row.count('#')
        return cnt == k

    def sieve_classic(self,a,b):
        self.primes = [True] * (b+1)
        self.primes[0] = self.primes[1] = False
        for i in range(2,b+1):
            if self.primes[i] and i*i <= b:
                for j in range(i*i,b+1,i):
                    self.primes[j] = False
        self.primes = [x for x,y in enumerate(self.primes) if y]
        ind = bisect.bisect_left(self.primes,a)
        self.primes[:ind] = []
        return None


if __name__=='__main__':
    solution = Solution()

    inputs = iter(sys.stdin.readlines())
    n = int(next(inputs))
    a = list(map(int, next(inputs).split()))
    ans = solution.solve(a)
    # print(ans)
