using System;
using System.Collections.Generic;
using System.Linq;

class Solution {
  public static void Main(string[] args) {
        int n = Convert.ToInt32(Console.ReadLine());
        List<int> numbers = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).ToList();
        numbers.Sort();
        numbers.Reverse();
        int result = 0;
        int c = 0;
        for (int i = 0; i < numbers.Count; i++)
        {
            result += numbers[i];
            c++;
            if (i != numbers.Count-1)
            {
                if (numbers[i] == numbers[i + 1])
                    c--;
            }
        }
        Console.WriteLine(result-c);
  }
}
