/*
TASK:mushroom
LANG:C++
*/
#include <iostream>
#include <stdio.h>
using namespace std;
int n, melody[1000], br = 0, a[128], c1 = 0, c2 = 0, c1max = -1, c2max = -1;
int note(int p)
{
    int s;
    for ( s = 0; s < n; s++ )
        if ( melody[s] == p )
           br++;
    a[p] = br;
    br = 0;
}
int main()
{
    int i, j;
    cin >> n;
    for ( i = 0; i < n; i++ )
        cin >> melody[i];
    for ( j = 1; j <= 127; j++ )
        note(melody[j]);
    for( i = 1; i <= 127; i++ )
    {
        if ( a[i] > c1 )
           c1 = a[i];
        if ((a[i] > c2 ) && ( a[i] != c1 ))
           c2 = a[i];
    }
    j = n - (c1 + c2);
    cout << j << endl;
    return 0;
}
