#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here # for every bird type N, increase the N'th item on birds by 1 birds = [0] * 5 for birdType in types: birds[birdType-1] += 1 #print(birds) # check frequency of each bird in descending order answer = 5 tops = 0 for birdFreq in range(0, 5): # if frequency of bird is either higher than the previous saved frequency or same but its index is lower ... if birds[::-1][birdFreq] >= tops: tops = birds[::-1][birdFreq] answer = 5 - birdFreq print(answer)