Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. She wants to have those pairs of flowers that their beauty difference is maximal possible!

Your task is to write a program which calculates two things:

  1. The maximum beauty difference of flowers that Pashmak can give to Parmida. 
  2. The number of ways that Pashmak can pick the flowers. Two ways are considered different if and only if there is at least one flower that is chosen in the first way and not chosen in the second way. 

Input

The first line of the input contains n (2 ≤ n ≤ 2·105). In the next line there are n space-separated integers b1, b2, ..., bn (1 ≤ bi ≤ 109).

Output

The only line of output should contain two integers. The maximum beauty difference and the number of ways this may happen, respectively.

Examples

Input

2
1 2


Output

1 1

Input

3
1 4 5


Output

4 1

Input

5
3 1 2 3 1


Output

2 4

Note

In the third sample the maximum beauty difference is 2 and there are 4 ways to do this:

  1. choosing the first and the second flowers; 
  2. choosing the first and the fifth flowers; 
  3. choosing the fourth and the second flowers; 
  4. choosing the fourth and the fifth flowers. 

import java.io.*;
import java.util.*;

public class Main {

    public static final String ANSI_RESET = "\u001B[0m";
    public static final String ANSI_RED = "\u001B[31m";
    public static final String ANSI_GREEN = "\u001B[33m";

    public static void main(String[] args) throws IOException {
        //FastScanner in = new FastScanner(new File("input.txt"));
        PrintWriter out = new PrintWriter(System.out);

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        //BufferedReader in;
        //in = new BufferedReader(new FileReader("a.txt"));
        //Scanner in =new Scanner(System.in);
        int n = Integer.parseInt(in.readLine());
        int h[] = new int[n + 1];
        String ch[] = in.readLine().split(" ");
        int min = Integer.MAX_VALUE;
        int max = 0;
        long maxCount = 1;
        long minCount = 1;

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ch[i]);
            if (max == h[i]) {
                maxCount++;
            } else {
                if (max < h[i]) {
                    max = h[i];
                    maxCount = 1;
                }
            }
            if (min == h[i]) {
                minCount++;
            } else if (min > h[i]) {
                min = h[i];
                minCount = 1;
            }
        }
        if (max == min) {
            System.out.println((max - min) + " " + ((maxCount*(maxCount-1))/2));
        } else {
            System.out.println((max - min) + " " + (maxCount * minCount));
        }
        out.close();

    }

    public boolean checkArithmeticProgression(int t[], int n) {
        if (n == 1) {
            return true;
        }
        radixSort(t);
        int d = t[1] - t[0];
        for (int i = 2; i < t.length; i++) {
            if (t[i] - t[i - 1] != d) {
                return false;
            }
        }
        return true;
    }

    public static int[] radixSort(int[] f) {
        return radixSort(f, f.length);
    }

    public static int[] radixSort(int[] f, int n) {
        int[] to = new int[n];
        {
            int[] b = new int[65537];
            for (int i = 0; i < n; i++) {
                b[1 + (f[i] & 0xffff)]++;
            }
            for (int i = 1; i <= 65536; i++) {
                b[i] += b[i - 1];
            }
            for (int i = 0; i < n; i++) {
                to[b[f[i] & 0xffff]++] = f[i];
            }
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < n; i++) {
                b[1 + (f[i] >>> 16)]++;
            }
            for (int i = 1; i <= 65536; i++) {
                b[i] += b[i - 1];
            }
            for (int i = 0; i < n; i++) {
                to[b[f[i] >>> 16]++] = f[i];
            }
            int[] d = f;
            f = to;
            to = d;
        }
        return f;

    }

    private static class FastScanner {

        private final InputStream stream;
        private final byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public FastScanner(File file) throws FileNotFoundException {
            this.stream = new FileInputStream(file);
        }

        int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        boolean isEndline(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

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

        public int[] nextArrayInt(int n) {
            int tab[] = new int[n];
            for (int i = 0; i < n; i++) {
                tab[i] = nextInt();
            }
            return tab;
        }

        public String[] nextArrayString(int n) {
            String tab[] = new String[n];
            for (int i = 0; i < n; i++) {
                tab[i] = next();
            }
            return tab;
        }

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

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

        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isEndline(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndline(c));
            return res.toString();
        }
    }
}
