You are given an alphabet consisting of n letters, your task is to make a string of the maximum possible length so that the following conditions are satisfied: 

  * the i-th letter occurs in the string no more than ai times; 
  * the number of occurrences of each letter in the string must be distinct for all the letters that occurred in the string at least once. 

Input

The first line of the input contains a single integer n (2 ≤ n ≤ 26) — the number of letters in the alphabet.

The next line contains n integers ai (1 ≤ ai ≤ 109) — i-th of these integers gives the limitation on the number of occurrences of the i-th character in the string.

Output

Print a single integer — the maximum length of the string that meets all the requirements.

Examples

Input

3
2 5 5


Output

11


Input

3
1 1 2


Output

3

Note

For convenience let's consider an alphabet consisting of three letters: "a", "b", "c". In the first sample, some of the optimal strings are: "cccaabbccbb", "aabcbcbcbcb". In the second sample some of the optimal strings are: "acc", "cbc".
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class SostavitStroku {

    private static Scanner in;
    private static Output out;
    static boolean isFile = false;

    public static void solve() throws Exception {
        int l = in.nextInt();
        long a[] = new long[l];
        long sum = 0;
        for (int i = 0; i < l; i++) {
            a[i] = in.nextInt();
            sum += a[i];
        }
        Arrays.sort(a);
        long diffCount = 0;
        outer: while (!isDiffer(a)) {
            for (int i = a.length - 1; i > 0; i--) {
                if (a[i] == a[i - 1] && a[i] != 0) {
                    diffCount++;
                    a[i]--;
                    continue;
                }
            }
        }
        out.println(sum - diffCount);

    }

    private static boolean isDiffer(long a[]) {
        Arrays.sort(a);
        boolean eq = false;
        for (int i = a.length - 1; i > 0; i--) {
            if (a[i] == a[i - 1] && a[i] != 0) {
                return false;
            }
        }
        return true;
    }

    static Exception exception;

    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    initReaderWriter();
                    solve();
                    out.close();
                } catch (Exception ex) {
                    exception = ex;
                }
            }
        }, "", 1 << 26);
        thread.start();
        thread.join();

        if (exception != null) {
            throw exception;
        }
    }

    private static void initReaderWriter() throws Exception {
        if (isFile) {
            in = new Scanner("input.txt");
            out = new Output(new File("output.txt"));
        } else {
            in = new Scanner();
            out = new Output(System.out);
        }
    }

    private static boolean log = false;

    public static void log(String msg) {
        if (log) {
            out.println(msg);
            out.flush();
        }
    }

    private static class Scanner {

        StringTokenizer st = null;
        BufferedReader bf;

        public Scanner() {
            bf = new BufferedReader(new InputStreamReader(System.in));
        }

        public Scanner(String fileName) throws FileNotFoundException {
            bf = new BufferedReader(new FileReader(fileName));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(bf.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return bf.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

    private static class Output extends PrintStream {

        public Output(OutputStream out) {
            super(new BufferedOutputStream(out));
        }

        public Output(File file) throws FileNotFoundException {
            super(new BufferedOutputStream(new FileOutputStream(file)));
        }
    }

    private static void printMemory() {
        Runtime runtime = Runtime.getRuntime();

        long maxMemory = runtime.maxMemory();
        long allocatedMemory = runtime.totalMemory();
        long freeMemory = runtime.freeMemory();

        long div = 1L * 1024 * 1024;
        // long div = 1L ;

        System.out.println("used memory[mgb]: " + (runtime.totalMemory() - runtime.freeMemory()) / div);

        System.out.println();
    }

    static long appCurrentTime = System.currentTimeMillis();
    static long appCurrentTimeNano = System.nanoTime();

    private static void printCurrentTime() {
        out.flush();
        System.out.println("Time: " + (System.currentTimeMillis() - appCurrentTime));
        System.out.println("Time Nano: " + (System.nanoTime() - appCurrentTimeNano));
    }
}
