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 void main(String [] args) throws FileNotFoundException {
        startTime = System.currentTimeMillis();
         // int T = sc.nextInt();while (T--!=0)
        {

            //  int TEST=10000;while (TEST--!=0)
            solve();
        }
        endTime = System.currentTimeMillis();
        long duration= endTime-startTime;
        //  System.out.println(duration);
    }
    // static Scanner sc = new Scanner(System.in);
    static FastReader sc = new FastReader();
    public static int swap(int... args) {
        return args[0];
    }
    static boolean isFair(long n ){
        String s = n+"";
        for (int i = 0; i < s.length(); i++) {
            int x=s.charAt(i)-'0';
            if(x!=0&&n%x!=0) return false;
        }
        return true;
    }
    public static void solve() throws FileNotFoundException  {
//////////////////////////////////////////////////////////////////////
       int n =sc.nextInt();
       Integer [] arr= new Integer[n];
        for (int i = 0; i < n; i++) {
                arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        int max= -arr[0]+arr[n-1];
        int mn=0,mx=0;
        for (int i = 0; i < n; i++) {
                if(arr[i].equals(arr[0])){
                   mn++;
                }
                else if(arr[i].equals(arr[n-1])){
                    mx++;
                }
        }
        long ans=mn*1L*mx;
        if(arr[0].equals(arr[n - 1])){
            ans=n*1L*(n-1)/2;
        }
        System.out.println(max+" " +ans);
///////////////////////////////////////////////////////////////////////
    }
    public static final String ANSI_RED = "\u001B[31m";
    public static final String ANSI_RESET = "\u001B[0m";
    static long startTime;
    static long endTime;
    static boolean [] prime ;
    static int M=(int)1e9+7;
    static long MM=M*M;
    static int MAX=Integer.MAX_VALUE;
    static int MIN=Integer.MIN_VALUE;
    static int SIZE = (int)1e9*2;
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
        long nextLong()
        {
            return Long.parseLong(next());
        }
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static class SortedList<E> extends AbstractList<E> {

        private ArrayList<E> internalList = new ArrayList<E>();

        // Note that add(E e) in AbstractList is calling this one
        @Override
        public void add(int position, E e) {
            internalList.add(e);
            Collections.sort(internalList, null);
        }

        @Override
        public E get(int i) {
            return internalList.get(i);
        }

        @Override
        public int size() {
            return internalList.size();
        }

    }
    static class Pair implements Comparable<Pair> {
        private   int x;
        private   int y;
        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int second(){
            return y;
        }
        @Override
        public int compareTo(Pair o) {
            return -Integer.compare(x, o.x);
        }

        @Override
        public String toString() {
            return "Pair{" +"x=" + x +", y=" + y +'}';
        }
    }
    public static void revArray(int [] arr){
        int n =arr.length;
        for (int i = 0; i < n/2; i++) {
            int temp=arr[i];
            arr[i]=arr[n-i-1];
            arr[n-i-1]=temp;
        }
    }
    public static void revArray(long [] arr){
        int n =arr.length;
        for (int i = 0; i < n/2; i++) {
            long temp=arr[i];
            arr[i]=arr[n-i-1];
            arr[n-i-1]=temp;
        }
    }
    public static void revArray(Long [] arr){
        int n =arr.length;
        for (int i = 0; i < n/2; i++) {
            Long temp=arr[i];
            arr[i]=arr[n-i-1];
            arr[n-i-1]=temp;
        }
    }
    public static void revArray(Integer [] arr){
        int n =arr.length;
        for (int i = 0; i < n/2; i++) {
            Integer temp=arr[i];
            arr[i]=arr[n-i-1];
            arr[n-i-1]=temp;
        }
    }
    static void printArray(int[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Integer[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void printArray(Long[] arr)
    {
        int n = arr.length;
        for (int i = 0; i < n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }
    static void yes(){
        System.out.println("YES");
    }
    static void no(){System.out.println("NO");}
    public static int lowerBound
            (Integer[] array, int length, int value) {
// Returns the index of the value or
// if there is no value, returns the closest to the left.
        int low=-1; // arr[low]<=tar
        int hi=length;//arr[hi]>tar
        while (low+1<hi){ // while pointers are not neighboring(low+1!=hi)
            int mid=(low+hi)/2;
            if(array[mid]<=value){
                low=mid;
            }
            else {
                hi=mid;
            }
        }
        return low;// if no such element, returns -1.
    }
    public static int upperBound(Integer[] array, int length, int value){
// returns the index of the value or
// if the value does not exist, returns the closest to the right
        int low=-1; // arr[low]<tar
        int hi=length;// arr[hi]>=tar
        while (low+1<hi){// Eventually, pointers should be adjacent.
            int mid=(low+hi)>>1;
            if(array[mid]>=value){
                hi=mid;
            }
            else low=mid;
        }
        return hi;
    }
    public static int binarySearch(Integer [] arr, int length, int value){
// returns the index of the targeted value or -1 if there is no value.
        int low=0;
        int hi=length-1;
        int ans=-1;
        while (low<=hi){
            int mid=(low+hi)>>1;
            if(arr[mid]>value){
                hi=mid-1;
            }
            else if(arr[mid]<value){
                low=mid+1;
            }
            else {
                ans=mid;
                break;
            }
        }
        return ans;
    }
    public static int gcd(int a, int b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static long lcm(int a , int b){
        return a/gcd(a,b)*b;
    }
    public static int countDivs(int n ){
        int cn=0;
        int sqr = (int)Math.sqrt(n);
        for (int i = 1; i<=sqr ; ++i) {
            if(n%i==0){
                ++cn;
            }
        }
        cn*=2;
        if(sqr*sqr==n) cn--;
        return cn;
    }
    static void prime(int x) {
//sieve algorithm. nlog(log(n)).
        prime=new boolean[ (x+1)];
        Arrays.fill(prime,true);
        prime[0] = prime[1] = false;
        for (int i = 2; i * i <= x ; i++)
            if (prime[i])
                for (int j = i * i; j <= x; j += i)
                    prime[j] = false;
    }
    static int[] sum;
    static void cumulitiveSum( int [] arr){
        sum = new int[arr.length];
        sum[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            sum[i]=arr[i]+sum[i-1];
        }
    }
    static boolean isEven(long x ){
        return x % 2 == 0;
    }
    static boolean isPrime(long x ){
        boolean flag = true;
        int sqr = (int)Math.sqrt(x);
        if(x<2) return false;
        for (int i = 2; i <=sqr; i++) {
            if(x%i==0){
                flag=false;
                break;
            }
        }
        return flag;
    }
    static long factorial( long x) {
        long total = 1;
        for (int i = 2; i <= x; i++)
            total = (total*i)%M;
        return total;
    }
    static long power(long x, long n) {
        if (n == 0) {
            return 1;
        }
        long pow = power(x, n / 2L);
        if ((n & 1) == 1) {
            return (x * (pow) * (pow));
        }
        return (pow * pow);
    }
    static void dg (String ss){
        System.out.println(ANSI_RED + ss + ANSI_RESET);
    }
    static void dg (int ss){
        System.out.println(ANSI_RED + ss + ANSI_RESET);
    }

}