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.text.DecimalFormat;
import java.io.*;
import java.util.*;
import java.lang.reflect.Array;

/**
 * @author Mukesh Singh
 *
 */


public class AB {

    private InputStream input;
    private PrintStream output;
    private Scanner inputSc;

    public AB(InputStream input, PrintStream output) {
        this.input = input;
        this.output = output;
        init();
    }

    private void init() {
        inputSc = new Scanner(input);
    }

    static int lineToInt(String line) {
        return Integer.parseInt(line);
    }

    static long lineToLong(String line) {
        return Long.parseLong(line);
    }
    static double lineToDouble(String line) {
        return Double.parseDouble(line);
    }


    public void solve() 
	{
            solveTestCase();
    }

/**
 * @define global / instance variables 
 */

	HashMap<Integer,Integer> mat[] ;
	long dist[] ;
	int vec[] ;
	int par[] ;
	boolean isDone[] ;
	final long INF = 100000000000000000L ;
	int N;
	double ar[];
/**
 * @solve test case 
 */
@SuppressWarnings("unchecked")
    private void solveTestCase() 
	{
		int i , j  , k , n , m ;
		long N , M, K;
		int x1 , y1 , x2 , y2 ;
		int a1,a2,b1,b2 ;
		DecimalFormat df = new DecimalFormat("#,###,##0.00");
        String str = inputSc.nextLine();
        String delims = "[ ]+";
		String[] tokens = str.split(delims);  
		n = lineToInt(tokens[0]);
		str = inputSc.nextLine();
		tokens = str.split(delims); 
		int ar[] = new int[n] ;
		int min , max ;
		min = 1000000003 ;
		max = 0 ;
		for( i = 0; i < n ; i ++ )
		{
			ar[i] = lineToInt(tokens[i]);
			
			if( min > ar[i] )
				min = ar[i] ;
			if( max < ar[i])
				max = ar[i] ;
		}
		//Arrays.sort(ar);
		int count1 , count2 ;
		count1=count2 = 0 ;
		//output.println(min+" "+max);
		for( i = 0 ; i < n ; i ++ )
		{
			if(min == ar[i] )
				count1 ++ ;
			if( max == ar[i])
				count2++ ;
		}
		int diff = max - min ;
		long ans = (long)count1 * (long)count2 ;
		if(diff == 0 )
			ans = (long)n * (long)(n-1)/2 ;
		output.println(diff+" "+ans);
		
			
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
	{
		FileInputStream in = null;
      	FileOutputStream out = null;
		PrintStream ps = null ;
		InputStream is = null ;
		try 
		{
         	is = new FileInputStream("file.in");
         	out = new FileOutputStream("file.out");
			ps = new PrintStream(out);
        }
		catch ( Exception e )
		{}

        AB sd = new AB(System.in, System.out);
        sd.solve();
		try
		{
        if (is != null) 
		{
	      is.close();
	    }
       	if (out != null) {
           	out.close();
       	}
		if (ps != null) {
           	ps.close();
         }
      	}catch (Exception e){}

		//SquareDetector sd = new SquareDetector(System.in, System.out);
        //sd.solve();
    }
}
   

