using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32( Console.ReadLine());
            int[] a = new int[n];
            for(int i =0;i<n;i++)
            {
                a[i] = Convert.ToInt32(Console.ReadLine());
            }
            Array.Sort(a);
            Array.Reverse(a);
            int sum =0;
            int y = 0;
            for(int i = 0;i<n;i++)
            {
               if(a[i]-y>0)
                {
                    sum = sum + (a[i] - y);
                    y++;
                }
                
            }
            Console.WriteLine(sum);
        }
    }
}