#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int array[n];
    int full[n];
    for(int i = 0; i < n; i++)
    {
        cin>>array[i];
        full[i] = 0;
    }
    sort(array, array + n);
    for(int a = 0; a < n; a++)
    {
        for(int k = a; k < n; k++)
        {
            if(array[k] > array[a] && full[k] == 0)
            {
                array[a] = -1;
                full[k] = 1;
                break;
            }
        }
    }
    int calc = 0;
    for(int j = 0; j < n; j++)
    {
        calc = calc + (bool(array[j] != -1))*array[j];
    }
    cout<<calc;
    return 0;
}
