#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
void solve(){
	int n;
	cin>>n;
	if(n<=30){
		cout<<"NO"<<endl;
		return;
	}
	int ar[7]={6,10,14,15,22,33};
	for(int i=0;i<sizeof(ar);i++){
		for(int j=i+1;j<sizeof(ar);j++){
			for(int k=j+1;k<sizeof(ar);k++){
				ll x=ar[i]+ar[j]+ar[k];
				if((n-x)!=ar[i] && (n-x)!=ar[j] && (n-x)!=ar[k]){
					cout<<"YES"<<endl;
					cout<<ar[i]<<" "<<ar[j]<<" "<<ar[k]<<" "<<n-x<<endl;
					return;
				}
			}
		}
	}
	cout<<"NO"<<endl;
}
int main(){
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
vector <ll> primes;
int a[200001];
void sieve(){
	int max=200001;
	for(int i=0;i<=max;i++)
		a[i]=1;
	a[0]=a[1]=0;
	for(int i=2;i*i<=max;i++){
		if(a[i]==1){
			for(int j=i*i;j<=max;j+=i)
				a[j]=0;
		}
	}
	for(int i=2;i<=max;i++){
		if(a[i]==1)
			primes.pb(i);
	}
}
void solve(){
	int n;
	cin>>n;
	if(n<30){
		cout<<"NO"<<endl;
		return;
	}
	if(n-(14+16)==6 || n-(14+16)==10 || n-(14+16)==14){
		if(n-31>0)
		cout<<"YES"<<endl;
		cout<<"6"<<" "<<"10"<<" "<<"15"<<" "<<n-31<<endl;
	}
	else{
		cout<<"YES"<<endl;
		cout<<"6"<<" "<<"10"<<" "<<"14"<<" "<<n-(14+16)<<endl;
	}
}
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
vector <ll> primes;
int a[200001];
void sieve(){
	int max=200001;
	for(int i=0;i<=max;i++)
		a[i]=1;
	a[0]=a[1]=0;
	for(int i=2;i*i<=max;i++){
		if(a[i]==1){
			for(int j=i*i;j<=max;j+=i)
				a[j]=0;
		}
	}
	for(int i=2;i<=max;i++){
		if(a[i]==1)
			primes.pb(i);
	}
}
void solve(){
	int n;
	cin>>n;
	if(n<30){
		cout<<"NO"<<endl;
		return;
	}
	cout<<"YES"<<endl;
	cout<<"6 "<<"10 ";
	if(n-(14+16)==6 || n-(14+16)==10 || n-(14+16)==14){
		cout<<"15 "<<n-31<<endl;
	}
	else{
		cout<<"14 "<<n-(14+16)<<endl;
	}
}
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
vector <ll> primes;
int a[200001];
void sieve(){
	int max=200001;
	for(int i=0;i<=max;i++)
		a[i]=1;
	a[0]=a[1]=0;
	for(int i=2;i*i<=max;i++){
		if(a[i]==1){
			for(int j=i*i;j<=max;j+=i)
				a[j]=0;
		}
	}
	for(int i=2;i<=max;i++){
		if(a[i]==1)
			primes.pb(i);
	}
}
void solve(){
	int n;
	cin>>n;
	if(n<30){
		cout<<"NO"<<endl;
		return;
	}
	cout<<"YES"<<endl;
	cout<<"6 "<<"10 ";
	if(n-(14+16)==6 || n-(14+16)==10 || n-(14+16)==14){
		if(n-31>0)
		cout<<"15 "<<n-31<<endl;
	}
	else{
		cout<<"14 "<<n-(14+16)<<endl;
	}
}
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
void solve(){
	int n;
	cin>>n;
	if(n<30)
		cout<<"NO"<<endl;
	else{
		cout<<"YES"<<endl;
		cout<<"5 "<<"6 ";
		if(abs(n-(14+11))==5 || abs(n-(14+11))==6)
			cout<<"15 "<<n-(15+11)<<endl;
		else
			cout<<"14 "<<n-(14+11)<<endl;
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
vector <ll> primes;
int a[200001];
void sieve(){
	int max=200001;
	for(int i=0;i<=max;i++)
		a[i]=1;
	a[0]=a[1]=0;
	for(int i=2;i*i<=max;i++){
		if(a[i]==1){
			for(int j=i*i;j<=max;j+=i)
				a[j]=0;
		}
	}
	for(int i=2;i<=max;i++){
		if(a[i]==1)
			primes.pb(i);
	}
}
void solve(){
	int n;
	cin>>n;
	if(n<30){
		cout<<"NO"<<endl;
		return;
	}
	if(n-(14+16)==6 || n-(14+16)==10 || n-(14+16)==14){
		if(n-31>0){
		cout<<"YES"<<endl;
		cout<<"6"<<" "<<"10"<<" "<<"15"<<" "<<n-31<<endl;
		}
	}
	else{
		cout<<"YES"<<endl;
		cout<<"6"<<" "<<"10"<<" "<<"14"<<" "<<n-(14+16)<<endl;
	}
}
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int T;
    cin >> T;

    while(T--){
        int n, c=14;
        cin >>n;
        if(n<=30) cout << "NO" << endl;
        else
        {
             cout <<"YES"<<endl;
             if(n==36 || n==40 || n==44) c++;
             cout << "6 10 "<<c<<" "<<n-c<<endl;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int T;
    cin >> T;

    while(T--){
        int n;
        cin >>n;
        if(n<=30) cout << "NO" << endl;
        else
        {
             cout <<"YES"<<endl;
             cout<<"6 10 15 "<<n-31<<endl;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int T;
    cin >> T;

    while(T--){
        int n;
        cin >>n;
        if(n<18) cout << "NO" << endl;
        else
        {
             cout <<"YES"<<endl;
             cout<<"6 6 6 "<<n-18<<endl;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int T;
    cin >> T;

    while(T--){
        int n;
        cin >>n;
        if(n<12) cout << "NO" << endl;
        else
        {
             cout <<"YES"<<endl;
             cout<<"4 4 4 "<<n-12<<endl;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int T;
    cin >> T;

    while(T--){
        int n;
        cin >>n;
        if(n<=30) cout << "NO" << endl;
        else
        {
             cout <<"YES"<<endl;
             cout<<"6 10 14 "<<n-30<<endl;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int T;
    cin >> T;

    while(T--){
        int n, c=14, ex=30;
        cin >>n;
        if(n<=30) cout << "NO" << endl;
        else
        {
             cout <<"YES"<<endl;
             if(n==36 || n==40 || n==44) c++, ex++;
             cout << "6 10 "<<c<<" "<<n-ex<<endl;
        }
    }
}


#include<iostream>
using namespace std;
int solve(long long int n)
{
	if(n==36){
			cout<<"YES"<<endl;
		 	cout<<"5 "<<"6 "<<"10 "<<"15"<<endl;
		 	return 0;}
		 if(n==44){
		 	cout<<"YES"<<endl;
		 	cout<<"6 "<<"7 "<<"10 "<<"21"<<endl;
		 	return 0;
		 }
		 if(n==40){
		 	cout<<"YES"<<endl;
		 	cout<<"2 "<<"6 "<<"10 "<<"22"<<endl;
		 	return 0;

		 }
		if(n>=31){
			cout<<"YES"<<endl;
			cout<<"6 "<<"10 "<<"14 "<<(n-30)<<endl;
			return 0;
		}

			cout<<"NO"<<endl;
		     return 0;
}
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		long long int n;
		cin>>n;
		solve(n);

	}
	return 0;
}


#include<iostream>
using namespace std;
int solve(long long int n)
{
	if(n==36){
			cout<<"YES"<<endl;
		 	cout<<"5 "<<"6 "<<"10 "<<"15"<<endl;
		 	return 0;}
		 if(n==44){
		 	cout<<"YES"<<endl;
		 	cout<<"6 "<<"7 "<<"10 "<<"21"<<endl;
		 	return 0;
		 }
		if(n>=31){
			cout<<"YES"<<endl;
			cout<<"6 "<<"10 "<<"14 "<<(n-30)<<endl;
			return 0;
		}

			cout<<"NO"<<endl;
		     return 0;
}
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		long long int n;
		cin>>n;
		solve(n);

	}
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		long long int n;
		cin>>n;
		if(n>=31){
			cout<<"YES"<<endl;
			cout<<"6 "<<"10 "<<"14 "<<(n-30)<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		long long int n;
		cin>>n;
		 if(n==44){
		 	cout<<"YES"<<endl;
		 	cout<<"6 "<<"7 "<<"10 "<<"21"<<endl;
		 	n=1;
		 }
		if(n>=31){
			cout<<"YES"<<endl;
			cout<<"6 "<<"10 "<<"14 "<<(n-30)<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		long long int n;
		cin>>n;
		 if(n==44){
		 	cout<<"YES"<<endl;
		 	cout<<"6 "<<"7 "<<"10 "<<"21"<<endl;
		 	n=1;
		 }
		if(n>31){
			cout<<"YES"<<endl;
			cout<<"6 "<<"10 "<<"14 "<<(n-30)<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn = 1e5 + 10;
int t,n,m;
int h[maxn];
int p[maxn];
int pass[maxn];
bool vis[maxn];
vector<vector<int>> g;

int dfs(int src,int pa)
{
    vis[src] = 1;
    int temp = 0;
    for(int x: g[src])
    {
        if(!vis[x] && x!=pa)
        {
            temp += dfs(x,src);
        }
    }
    pass[src] = temp + p[src];
    return pass[src];
}

int main()
{   int i,j,x,y;
    cin>>t;
    while(t--)
    {
        cin>>n>>m;
        g = vector<vector<int>>(n+1);
        for(i=1;i<=n;i++) { cin>>p[i]; }
        for(i=1;i<=n;i++) { cin>>h[i]; }
        for(i=1;i<=n-1;i++)
        {
            cin>>x>>y;
            g[x].pb(y); g[y].pb(x);
        }
        dfs(1,0);
        for(i=1;i<=n;i++) { if(h[i]>pass[i] || h[i]<-pass[i]){break;} }
        if(i!=n+1) { cout<<"NO\n"; }
        else cout<<"YES\n";
    }
    return 0;
}


import kotlin.math.abs
fun main(args: Array<String>) {
    var N = readLine()!!.toInt()
    var l = readLine()!!.split(' ').map(String::toLong)
    var c = 0
    var v:Long = l.last()
    l = l.sorted()
    for(i in 1 until N) {
        if (l[i] - l[i - 1] == v){
            c++
    }
        else if(l[i] - l[i-1] < v){
            v = l[i] - l[i-1]
            c = 1
        }

    }
    print("$v $c")
}


import kotlin.math.abs
fun main(args: Array<String>) {
    var N = readLine()!!.toLong()
    var l = readLine()!!.split(' ').map(String::toLong)
    var c = 0
    l = l.sorted()
    var v:Long = l.last()
    for (i in l) {
        for (j in l){
            if ((abs(i) - abs(j) < v) && (abs(i) != abs(j))) {
                v = abs(abs(i) - abs(j))
            }
        }
    }
    for (i in l) {
        for (j in l){
            if (abs(i - j) == v) {
                c++
            }
        }
    }
    c /= 2
    print("$v $c")
}


import java.util.Arrays
import java.util.Scanner

object Main {
    @JvmStatic
    fun main(args: Array<String>) {
        val `in` = Scanner(System.`in`)
        val n = `in`.nextInt()
        val a = arrayOfNulls<Long>(n)
        for (i in 0 until n)
            a[i] = `in`.nextLong()
        Arrays.sort(a)
        var count = 0
        var min = Integer.MAX_VALUE.toLong()
        for (i in 0 until n - 1) {
            if (Math.abs(a[i]!! - a[i + 1]!!.toLong()) == min)
                count++
            if (Math.abs(a[i]!! - a[i + 1]!!) < min) {
                min = Math.abs(a[i]!! - a[i + 1]!!)
                count = 1
            }

        }

        println("${min.toString()} $count")
    }
}


import kotlin.math.absoluteValue

fun main() {
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val numCities = readInt()
    val coordinates = readInts().sorted()
    var minDistance = Int.MAX_VALUE
    var numPairs = 0
    for (pos in 1 until numCities) {
        val distance = (coordinates[pos] - coordinates[pos - 1]).absoluteValue
        if (distance < minDistance) {
            minDistance = distance
            numPairs = 1
        } else if (distance == minDistance)
            numPairs++
    }
    print("$minDistance $numPairs")
}


import kotlin.math.abs
import kotlin.math.min

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

fun main() {
    readLine()
    val cities = readLine()!!.split(" ").map { it.toLong() }.sorted()
    val distances = cities.mapIndexed { index, value ->
        val left = if (index > 0) {
            abs(value - cities[index - 1])
        } else {
            Long.MAX_VALUE
        }

        val right = if (index < cities.size - 1) {
            abs( cities[index + 1] - value)
        } else {
            Long.MAX_VALUE
        }
        min(left, right)
    }

    val minValue = distances.min()!!
    val count = (0..cities.size - 2).filter { abs(cities[it] - cities[it + 1]) == minValue }.count()
    print("$minValue $count")
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1
#define abs(x) (((x) < 0) ? -(x) : (x))
void insSort_ui(uint32_t* a, int left, int right) {
    for (int i = left + 1; i <= right; ++i) {
        if (a[i] < a[i - 1]) {
            uint32_t tmp = a[i];
            a[i] = a[i - 1];
            int j = i - 2;
            while (j >= left && tmp < a[j]) {
                a[j + 1] = a[j];
                --j;
            }
            a[j + 1] = tmp;
        }
    }
}
void flagSortImpl_ui(uint32_t* a, uint32_t* b, int left, int right, int shift) {
    if (right - left < 32) {
        insSort_ui(a, left, right);
        if ((shift & 15) == 0) { // if ((shift % 16) == 0)
            memcpy(b + left, a + left, (right + 1) * sizeof(uint32_t));
        }
        return;
    }

    int offset[256] = { 0 };
    for (int i = left; i <= right; ++i) {
        ++offset[(a[i] >> shift) & 0xFF];
    }
    int cur_pos = left;
    for (int i = 0; i < 256; ++i) {
        int count = offset[i];
        offset[i] = cur_pos;
        cur_pos += count;
    }
    for (int i = left; i <= right; ++i) {
        int partition = (a[i] >> shift) & 0xFF;
        b[offset[partition]] = a[i];
        ++offset[partition];
    }

    if (shift > 0) {
        shift -= 8;
        if (offset[0] > left) {
            flagSortImpl_ui(b, a, left, offset[0] - 1, shift);
        }
        for (int i = 1; i < 256; ++i) {
            if (offset[i] > offset[i - 1]) {
                flagSortImpl_ui(b, a, offset[i - 1], offset[i] - 1, shift);
            }
        }
    }
}
void flagSort_i(int32_t* a, int left, int right) {
    /* convert to unsigned int by 'adding' 2^31 */
    for (int i = left; i <= right; ++i) a[i] ^= INT32_MIN;

    int32_t* b = (int32_t*)malloc((right + 1) * sizeof(int32_t));
    flagSortImpl_ui((uint32_t*)a, (uint32_t*)b, left, right, 24);
    free(b);

    /* convert back to signed int by 'subtracting' 2^31 */
    for (int i = left; i <= right; ++i) a[i] ^= INT32_MIN;
}

#define N 200005

int data[N];

int main() {
    int n;
    scanf("%d", &n);
    fore (i, 1, n) {
        scanf("%d", &data[i]);
    }

    flagSort_i(data, 1, n);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 2, n) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1
void insSort_i(int32_t* a, int left, int right) {
    for (int i = left + 1; i <= right; ++i) {
        if (a[i] < a[i - 1]) {
            int32_t tmp = a[i];
            a[i] = a[i - 1];
            int j = i - 2;
            while (j >= left && tmp < a[j]) {
                a[j + 1] = a[j];
                --j;
            }
            a[j + 1] = tmp;
        }
    }
}
/*
 * Sorts the specified range of the array by Dual-Pivot Quicksort.
 * Adapted from the algorithm invented by Vladimir Yaroslavskiy,
 * Jon Bentley, and Josh Bloch.
 */
void dpqSort_i(int32_t* a, int left, int right) {
    int length = right - left + 1;
    if (length <= 1) return;

    if (length <= 32) {
        insSort_i(a, left, right);
        return;
    }

    // Inexpensive approximation of length / 7
    int seventh = (length >> 3) + (length >> 6) + 1;
    // Sort five evenly spaced element to be used for pivot selection
    int e3 = (left + right) / 2; // The midpoint
    int e2 = e3 - seventh;
    int e1 = e2 - seventh;
    int e4 = e3 + seventh;
    int e5 = e4 + seventh;
    // Sort these elements using insertion sort
    if (a[e2] < a[e1]) { int32_t t = a[e2]; a[e2] = a[e1]; a[e1] = t; }
    if (a[e3] < a[e2]) { int32_t t = a[e3]; a[e3] = a[e2]; a[e2] = t;
        if (t < a[e1]) { a[e2] = a[e1]; a[e1] = t; }
    }
    if (a[e4] < a[e3]) { int32_t t = a[e4]; a[e4] = a[e3]; a[e3] = t;
        if (t < a[e2]) { a[e3] = a[e2]; a[e2] = t;
            if (t < a[e1]) { a[e2] = a[e1]; a[e1] = t; }
        }
    }
    if (a[e5] < a[e4]) { int32_t t = a[e5]; a[e5] = a[e4]; a[e4] = t;
        if (t < a[e3]) { a[e4] = a[e3]; a[e3] = t;
            if (t < a[e2]) { a[e3] = a[e2]; a[e2] = t;
                if (t < a[e1]) { a[e2] = a[e1]; a[e1] = t; }
            }
        }
    }

    int less  = left;  // The index of the first element of center part
    int great = right; // The index of the last element of center part

    if (a[e1] != a[e2] && a[e2] != a[e3] && a[e3] != a[e4] && a[e4] != a[e5]) {
        // Use the second and fourth of the five sorted elements as pivots.
        int32_t pivot1 = a[e2];
        int32_t pivot2 = a[e4];
        // Move l and r to pivot locations. Pivots will be swapped back later.
        a[e2] = a[left];
        a[e4] = a[right];
        // Pass over l and r and skip elements less or greater than pivot values.
        while (a[++less] < pivot1);
        while (a[--great] > pivot2);

        for (int k = less; k <= great; ++k) {
            int32_t ak = a[k];
            if (ak < pivot1) { // Move a[k] to left part
                a[k] = a[less];
                a[less] = ak;
                ++less;
            } else if (ak > pivot2) { // Move a[k] to right part
                while (a[great] > pivot2) {
                    if (great-- == k) {
                        goto breakout1;
                    }
                }
                if (a[great] < pivot1) { // a[great] <= pivot2
                    a[k] = a[less];
                    a[less] = a[great];
                    ++less;
                } else { // pivot1 <= a[great] <= pivot2
                    a[k] = a[great];
                }
                a[great] = ak;
                --great;
            }
        }
        breakout1:
        // Swap pivots into their final positions
        a[left]  = a[less  - 1]; a[less  - 1] = pivot1;
        a[right] = a[great + 1]; a[great + 1] = pivot2;
        // Sort left and right parts recursively, excluding known pivots
        dpqSort_i(a, left, less - 2);
        dpqSort_i(a, great + 2, right);

        // If center is too large, partition values equal to pivots out to ends
        if (less < e1 && e5 < great) {
            //Skip elements, which are equal to pivot values.
            while (less <= great && a[less] == pivot1) ++less;
            while (less <= great && a[great] == pivot2) --great;

            for (int k = less; k <= great; ++k) {
                int32_t ak = a[k];
                if (ak == pivot1) { // Move a[k] to left part
                    a[k] = a[less];
                    a[less] = ak;
                    ++less;
                } else if (ak == pivot2) { // Move a[k] to right part
                    while (a[great] == pivot2) {
                        if (great-- == k) {
                            goto breakout2;
                        }
                    }
                    if (a[great] == pivot1) { // a[great] < pivot2
                        a[k] = a[less];
                        a[less] = pivot1;
                        ++less;
                    } else { // pivot1 < a[great] < pivot2
                        a[k] = a[great];
                    }
                    a[great] = ak;
                    --great;
                }
            }
        }
        breakout2:
        // Sort center part recursively
        dpqSort_i(a, less, great);

    } else { // Partitioning with one pivot
        // Use the third of the five sorted elements as pivot.
        int32_t pivot = a[e3];

        for (int k = less; k <= great; ++k) {
            if (a[k] == pivot) {
                continue;
            }
            int32_t ak = a[k];
            if (ak < pivot) { // Move a[k] to left part
                a[k] = a[less];
                a[less] = ak;
                ++less;
            } else { // a[k] > pivot - Move a[k] to right part
                while (a[great] > pivot) {
                    --great;
                }
                if (a[great] < pivot) { // a[great] <= pivot
                    a[k] = a[less];
                    a[less] = a[great];
                    ++less;
                } else { // a[great] == pivot
                    a[k] = pivot;
                }
                a[great] = ak;
                --great;
            }
        }
        // Sort left and right parts recursively.
        dpqSort_i(a, left, less - 1);
        dpqSort_i(a, great + 1, right);
    }
}

#define N 200005

int data[N];

int main() {
    int n;
    scanf("%d", &n);
    fore (i, 0, n-1) {
        scanf("%d", &data[i]);
    }

    dpqSort_i(data, 0, n-1);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 1, n-1) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1
#define abs(x) (((x) < 0) ? -(x) : (x))
void insSort_ui(uint32_t* a, int left, int right) {
    for (int i = left + 1; i <= right; ++i) {
        if (a[i] < a[i - 1]) {
            uint32_t tmp = a[i];
            a[i] = a[i - 1];
            int j = i - 2;
            while (j >= left && tmp < a[j]) {
                a[j + 1] = a[j];
                --j;
            }
            a[j + 1] = tmp;
        }
    }
}
void flagSortImpl_ui(uint32_t* a, uint32_t* b, int left, int right, int shift) {
    if (right - left < 32) {
        insSort_ui(a, left, right);
        if ((shift & 15) == 0) { // if ((shift % 16) == 0)
            memcpy(b + left, a + left, (right + 1) * sizeof(uint32_t));
        }
        return;
    }

    int offset[256] = { 0 };
    for (int i = left; i <= right; ++i) {
        ++offset[(a[i] >> shift) & 0xFF];
    }
    int cur_pos = left;
    for (int i = 0; i < 256; ++i) {
        int count = offset[i];
        offset[i] = cur_pos;
        cur_pos += count;
    }
    for (int i = left; i <= right; ++i) {
        int partition = (a[i] >> shift) & 0xFF;
        b[offset[partition]] = a[i];
        ++offset[partition];
    }

    if (shift > 0) {
        shift -= 8;
        if (offset[0] > left) {
            flagSortImpl_ui(b, a, left, offset[0] - 1, shift);
        }
        for (int i = 1; i < 256; ++i) {
            if (offset[i] > offset[i - 1]) {
                flagSortImpl_ui(b, a, offset[i - 1], offset[i] - 1, shift);
            }
        }
    }
}
void flagSort_ui(uint32_t* a, int left, int right) {
    uint32_t* b = (uint32_t*)malloc((right + 1) * sizeof(uint32_t));
    flagSortImpl_ui(a, b, left, right, 24);
    free(b);
}

#define N 200005

int data[N];

int main() {
    int n;
    scanf("%d", &n);
    fore (i, 1, n) {
        scanf("%d", &data[i]);
        data[i] += 1000000000;
    }
    flagSort_ui(data, 1, n);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 2, n) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1
void insSort_ui(uint32_t* a, int left, int right) {
    for (int i = left + 1; i <= right; ++i) {
        if (a[i] < a[i - 1]) {
            uint32_t tmp = a[i];
            a[i] = a[i - 1];
            int j = i - 2;
            while (j >= left && tmp < a[j]) {
                a[j + 1] = a[j];
                --j;
            }
            a[j + 1] = tmp;
        }
    }
}
void flagSortImpl_ui(uint32_t* a, uint32_t* b, int left, int right, int shift) {
    if (right - left < 32) {
        insSort_ui(a, left, right);
        if ((shift & 15) == 0) { // if ((shift % 16) == 0)
            memcpy(b + left, a + left, (right + 1) * sizeof(uint32_t));
        }
        return;
    }

    int offset[256] = { 0 };
    for (int i = left; i <= right; ++i) {
        ++offset[(a[i] >> shift) & 0xFF];
    }
    int cur_pos = left;
    for (int i = 0; i < 256; ++i) {
        int count = offset[i];
        offset[i] = cur_pos;
        cur_pos += count;
    }
    for (int i = left; i <= right; ++i) {
        int partition = (a[i] >> shift) & 0xFF;
        b[offset[partition]] = a[i];
        ++offset[partition];
    }

    if (shift > 0) {
        shift -= 8;
        if (offset[0] > left) {
            flagSortImpl_ui(b, a, left, offset[0] - 1, shift);
        }
        for (int i = 1; i < 256; ++i) {
            if (offset[i] > offset[i - 1]) {
                flagSortImpl_ui(b, a, offset[i - 1], offset[i] - 1, shift);
            }
        }
    }
}
void flagSort_i(int32_t* a, int left, int right) {
    /* convert to unsigned int by 'adding' 2^31 */
    for (int i = left; i <= right; ++i) a[i] ^= INT32_MIN;

    int32_t* b = (int32_t*)malloc((right + 1) * sizeof(int32_t));
    flagSortImpl_ui((uint32_t*)a, (uint32_t*)b, left, right, 24);
    free(b);

    /* convert back to signed int by 'subtracting' 2^31 */
    for (int i = left; i <= right; ++i) a[i] ^= INT32_MIN;
}

#define N 200005

int data[N];

int main() {
    int n;
    scanf("%d", &n);
    fore (i, 0, n-1) {
        scanf("%d", &data[i]);
    }

    flagSort_i(data, 0, n-1);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 1, n-1) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1

void swap_i(int32_t* a, int i, int j) {
    int32_t tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
}
void reverse_i(int32_t* a, int left, int right) {
    int mid = ((right - left + 1) >> 1);
    for (int i = 0; i < mid; ++i) {
        swap_i(a, left + i, right - i);
    }
}
void merge_i(int32_t* a, int begin, int mid, int end, int32_t* b, int offset) {
    int i = begin, j = mid, size = end - begin + 1;
    for (int k = 0; k < size; ++k) {
        if (i < mid && (j > end || a[i] <= a[j])) {
            b[k+offset] = a[i];
            ++i;
        } else {
            b[k+offset] = a[j];
            ++j;
        }
    }
}
void runSort_i(int32_t* a, int left, int right) {
    if (right <= left) return;
    int size = right - left + 1;
    int32_t* b = (int32_t*)malloc(size * sizeof(int32_t));
    int* runstack = (int*)malloc(((size >> 1) + 3) * sizeof(int));
    int rsTop = 0;
    runstack[rsTop++] = left - 1;
    int idx = left;
    int pos = idx;
    while (idx <= right) {
        if (idx == right) {
            runstack[rsTop++] = idx;
            break;
        }
        if (a[idx] > a[idx+1]) { // reverse run
            while (idx < right && a[idx] > a[idx+1]) ++idx;
            reverse_i(a, pos, idx);
        } else { // non-decreasing run
            while (idx < right && a[idx] <= a[idx+1]) ++idx;
        }
        runstack[rsTop++] = idx; // idx points to last element of run
        pos = ++idx;
    }
    while (rsTop > 2) {
        int rsPtr = 0;
        int rsNewTop = 1;
        runstack[rsTop] = runstack[rsTop-1]; // so last of odd number of runs can 'merge'
        while (rsPtr < rsTop - 1) {
            merge_i(a, runstack[rsPtr] + 1, runstack[rsPtr+1] + 1,
                    runstack[rsPtr+2], b, runstack[rsPtr] + 1 - left);
            rsPtr += 2;
            runstack[rsNewTop++] = runstack[rsPtr];
        }
        if (rsNewTop == 2) { // only one run remains, and it is in b
            for (int i = 0; i < size; ++i) {
                a[left+i] = b[i];
            }
            break;
        }
        rsTop = rsNewTop;
        rsPtr = 0;
        rsNewTop = 1;
        runstack[rsTop] = runstack[rsTop-1]; // so last of odd number of runs can 'merge'
        while (rsPtr < rsTop - 1) {
            merge_i(b, runstack[rsPtr] + 1 - left, runstack[rsPtr+1] + 1 - left,
                    runstack[rsPtr+2] - left, a, runstack[rsPtr] + 1);
            rsPtr += 2;
            runstack[rsNewTop++] = runstack[rsPtr];
        }
        rsTop = rsNewTop;
    }
    free(runstack);
    free(b);
    return;
}

#define N 200005

int data[N];

int main() {

    int n;
    scanf("%d", &n);
    fore (i, 0, n-1) {
        scanf("%d", &data[i]);
    }

    runSort_i(data, 0, n-1);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 1, n-1) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1
#define abs(x) (((x) < 0) ? -(x) : (x))
void insSort_i(int32_t* a, int left, int right) {
    for (int i = left + 1; i <= right; ++i) {
        if (a[i] < a[i - 1]) {
            int32_t tmp = a[i];
            a[i] = a[i - 1];
            int j = i - 2;
            while (j >= left && tmp < a[j]) {
                a[j + 1] = a[j];
                --j;
            }
            a[j + 1] = tmp;
        }
    }
}
/*
 * Sorts the specified range of the array by Dual-Pivot Quicksort.
 * Adapted from the algorithm invented by Vladimir Yaroslavskiy,
 * Jon Bentley, and Josh Bloch.
 */
void dpqSort_i(int32_t* a, int left, int right) {
    int length = right - left + 1;
    if (length <= 1) return;

    if (length <= 32) {
        insSort_i(a, left, right);
        return;
    }

    // Inexpensive approximation of length / 7
    int seventh = (length >> 3) + (length >> 6) + 1;
    // Sort five evenly spaced element to be used for pivot selection
    int e3 = (left + right) / 2; // The midpoint
    int e2 = e3 - seventh;
    int e1 = e2 - seventh;
    int e4 = e3 + seventh;
    int e5 = e4 + seventh;
    // Sort these elements using insertion sort
    if (a[e2] < a[e1]) { int32_t t = a[e2]; a[e2] = a[e1]; a[e1] = t; }
    if (a[e3] < a[e2]) { int32_t t = a[e3]; a[e3] = a[e2]; a[e2] = t;
        if (t < a[e1]) { a[e2] = a[e1]; a[e1] = t; }
    }
    if (a[e4] < a[e3]) { int32_t t = a[e4]; a[e4] = a[e3]; a[e3] = t;
        if (t < a[e2]) { a[e3] = a[e2]; a[e2] = t;
            if (t < a[e1]) { a[e2] = a[e1]; a[e1] = t; }
        }
    }
    if (a[e5] < a[e4]) { int32_t t = a[e5]; a[e5] = a[e4]; a[e4] = t;
        if (t < a[e3]) { a[e4] = a[e3]; a[e3] = t;
            if (t < a[e2]) { a[e3] = a[e2]; a[e2] = t;
                if (t < a[e1]) { a[e2] = a[e1]; a[e1] = t; }
            }
        }
    }

    int less  = left;  // The index of the first element of center part
    int great = right; // The index of the last element of center part

    if (a[e1] != a[e2] && a[e2] != a[e3] && a[e3] != a[e4] && a[e4] != a[e5]) {
        // Use the second and fourth of the five sorted elements as pivots.
        int32_t pivot1 = a[e2];
        int32_t pivot2 = a[e4];
        // Move l and r to pivot locations. Pivots will be swapped back later.
        a[e2] = a[left];
        a[e4] = a[right];
        // Pass over l and r and skip elements less or greater than pivot values.
        while (a[++less] < pivot1);
        while (a[--great] > pivot2);

        for (int k = less; k <= great; ++k) {
            int32_t ak = a[k];
            if (ak < pivot1) { // Move a[k] to left part
                a[k] = a[less];
                a[less] = ak;
                ++less;
            } else if (ak > pivot2) { // Move a[k] to right part
                while (a[great] > pivot2) {
                    if (great-- == k) {
                        goto breakout1;
                    }
                }
                if (a[great] < pivot1) { // a[great] <= pivot2
                    a[k] = a[less];
                    a[less] = a[great];
                    ++less;
                } else { // pivot1 <= a[great] <= pivot2
                    a[k] = a[great];
                }
                a[great] = ak;
                --great;
            }
        }
        breakout1:
        // Swap pivots into their final positions
        a[left]  = a[less  - 1]; a[less  - 1] = pivot1;
        a[right] = a[great + 1]; a[great + 1] = pivot2;
        // Sort left and right parts recursively, excluding known pivots
        dpqSort_i(a, left, less - 2);
        dpqSort_i(a, great + 2, right);

        // If center is too large, partition values equal to pivots out to ends
        if (less < e1 && e5 < great) {
            //Skip elements, which are equal to pivot values.
            while (less <= great && a[less] == pivot1) ++less;
            while (less <= great && a[great] == pivot2) --great;

            for (int k = less; k <= great; ++k) {
                int32_t ak = a[k];
                if (ak == pivot1) { // Move a[k] to left part
                    a[k] = a[less];
                    a[less] = ak;
                    ++less;
                } else if (ak == pivot2) { // Move a[k] to right part
                    while (a[great] == pivot2) {
                        if (great-- == k) {
                            goto breakout2;
                        }
                    }
                    if (a[great] == pivot1) { // a[great] < pivot2
                        a[k] = a[less];
                        a[less] = pivot1;
                        ++less;
                    } else { // pivot1 < a[great] < pivot2
                        a[k] = a[great];
                    }
                    a[great] = ak;
                    --great;
                }
            }
        }
        breakout2:
        // Sort center part recursively
        dpqSort_i(a, less, great);

    } else { // Partitioning with one pivot
        // Use the third of the five sorted elements as pivot.
        int32_t pivot = a[e3];

        for (int k = less; k <= great; ++k) {
            if (a[k] == pivot) {
                continue;
            }
            int32_t ak = a[k];
            if (ak < pivot) { // Move a[k] to left part
                a[k] = a[less];
                a[less] = ak;
                ++less;
            } else { // a[k] > pivot - Move a[k] to right part
                while (a[great] > pivot) {
                    --great;
                }
                if (a[great] < pivot) { // a[great] <= pivot
                    a[k] = a[less];
                    a[less] = a[great];
                    ++less;
                } else { // a[great] == pivot
                    a[k] = pivot;
                }
                a[great] = ak;
                --great;
            }
        }
        // Sort left and right parts recursively.
        dpqSort_i(a, left, less - 1);
        dpqSort_i(a, great + 1, right);
    }
}

#define N 200005

int data[N];

int main() {
    int n;
    scanf("%d", &n);
    fore (i, 1, n) {
        scanf("%d", &data[i]);
    }

    dpqSort_i(data, 1, n);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 2, n) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1

void insSort_ui(uint32_t* a, int left, int right) {
    for (int i = left + 1; i <= right; ++i) {
        if (a[i] < a[i - 1]) {
            uint32_t tmp = a[i];
            a[i] = a[i - 1];
            int j = i - 2;
            while (j >= left && tmp < a[j]) {
                a[j + 1] = a[j];
                --j;
            }
            a[j + 1] = tmp;
        }
    }
}
void flagSortImpl_ui(uint32_t* a, uint32_t* b, int left, int right, int shift) {
    if (right - left < 32) {
        insSort_ui(a, left, right);
        if ((shift & 15) == 0) { // if ((shift % 16) == 0)
            for (int i = left; i <= right; ++i) b[i] = a[i];
        }
        return;
    }

    int offset[256] = { 0 };
    for (int i = left; i <= right; ++i) {
        ++offset[(a[i] >> shift) & 0xFF];
    }
    int cur_pos = left;
    for (int i = 0; i < 256; ++i) {
        int count = offset[i];
        offset[i] = cur_pos;
        cur_pos += count;
    }
    for (int i = left; i <= right; ++i) {
        int partition = (a[i] >> shift) & 0xFF;
        b[offset[partition]] = a[i];
        ++offset[partition];
    }

    if (shift > 0) {
        shift -= 8;
        if (offset[0] > left) {
            flagSortImpl_ui(b, a, left, offset[0] - 1, shift);
        }
        for (int i = 1; i < 256; ++i) {
            if (offset[i] > offset[i - 1]) {
                flagSortImpl_ui(b, a, offset[i - 1], offset[i] - 1, shift);
            }
        }
    }
}
void flagSort_i(int32_t* a, int left, int right) {
    /* convert to unsigned int by 'adding' 2^31 */
    for (int i = left; i <= right; ++i) a[i] ^= INT32_MIN;

    int32_t* b = (int32_t*)malloc((right + 1) * sizeof(int32_t));
    flagSortImpl_ui((uint32_t*)a, (uint32_t*)b, left, right, 24);
    free(b);

    /* convert back to signed int by 'subtracting' 2^31 */
    for (int i = left; i <= right; ++i) a[i] ^= INT32_MIN;
}

#define N 200005

int data[N];

int main() {

    int n;
    scanf("%d", &n);
    fore (i, 0, n-1) {
        scanf("%d", &data[i]);
    }

    flagSort_i(data, 0, n-1);
    int minv = INT_MAX;
    int minc = 0;
    fore (i, 1, n-1) {
        int t = abs(data[i] - data[i-1]);
        if (t < minv) {
            minv = t;
            minc = 1;
        } else if (t == minv) ++minc;
    }
    printf("%d %d", minv, minc);

    return 0;
}


#include <limits.h>
#include <stdio.h>
#include <stdlib.h>

#define N	200000

int compare(const void *a, const void *b) {
	int *ia = (int *) a;
	int *ib = (int *) b;

	return *ia - *ib;
}

int main() {
	static int aa[N];
	int n, i, min, cnt;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	qsort(aa, n, sizeof *aa, compare);
	min = INT_MAX, cnt = 0;
	for (i = 1; i < n; i++)
		if (min > aa[i] - aa[i - 1]) {
			min = aa[i] - aa[i - 1];
			cnt = 1;
		} else if (min == aa[i] - aa[i - 1])
			cnt++;
	printf("%d %d\n", min, cnt);
	return 0;
}


#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define N	200000

int compare(const void *a, const void *b) {
	int *ia = (int *) a;
	int *ib = (int *) b;

	return *ia - *ib;
}

int main() {
	static int aa[N];
	int n, i, min, cnt;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	srand(time(NULL));
	for (i = n - 1; i >= 0; i--) {
		int j = rand() % (i + 1), tmp;

		tmp = aa[i], aa[i] = aa[j], aa[j] = tmp;
	}
	qsort(aa, n, sizeof *aa, compare);
	min = INT_MAX, cnt = 0;
	for (i = 1; i < n; i++)
		if (min > aa[i] - aa[i - 1]) {
			min = aa[i] - aa[i - 1];
			cnt = 1;
		} else if (min == aa[i] - aa[i - 1])
			cnt++;
	printf("%d %d\n", min, cnt);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
	return *((const long *)b)-*((const long *)a);
}

void main(){
long long n,i,j,min,count;count=0;min;
scanf("%lld",&n);
long long a[n],b[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

qsort(a,n,sizeof(long long),cmp);

for(i=0;i<n-1;i++)
	b[i]=a[i+1]-a[i];

	qsort(b,n-1,sizeof(long long),cmp);

	min=b[0];

	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
		else
			break;
	}

printf("%lld %lld\n",min,count);
exit(0);
}


#include<stdio.h>
#include<stdlib.h>
void quicksort(long long[],long long,long long);
 long long partition(long long [],long long,long long);
void main()
{
long long n,i,j,min,count;count=0;min=9000000000;
scanf("%lld",&n);
long long a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

quicksort(a,0,n-1);

for(i=0;i<n;i++)
{
	if((a[i+1]-a[i])<min)
	{
		min=a[i+1]-a[i];
		count=0;
	}

	if((a[i+1]-a[i])==min)
     count++;
}

printf("%lld %lld\n",min,count);
exit(0);
}

void quicksort(long long a[],long long s,long long e)
  {
	  long long p;
   if(s<e)
   {
    p=partition(a,e,s);
    quicksort(a,s,p-1);
	quicksort(a,p+1,e);
	}
	else
		return;
 }

 long long partition(long long a[],long long n,long long s )
 {
 long long pivot,p,t,i;
 pivot=n;
 p=s;
 for(i=s;i<n;i++)
 {
  if(a[i]<=a[pivot])
  {
  t=a[i];
  a[i]=a[p];
  a[p]=t;
  p++;
  }
 }
 t=a[p];
 a[p]=a[n];
 a[n]=t;

 return p;
}


#include<stdio.h>
#include<stdlib.h>
void quicksort(long long[],long long,long long);
 long long partition(long long [],long long,long long);
void main(){
long long n,i,j,min,count;count=0;min;
scanf("%lld",&n);
long long a[n],b[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

quicksort(a,0,n-1);

for(i=0;i<n-1;i++)
	b[i]=a[i+1]-a[i];

	quicksort(b,0,n-2);

	min=b[0];

	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
		else
			break;
	}

printf("%lld %lld\n",min,count);
exit(0);
}

void quicksort(long long a[],long long s,long long e)
  {
	  long long p;
   if(s<e)
   {
    p=partition(a,e,s);
    quicksort(a,s,p-1);
	quicksort(a,p+1,e);
	}
	else
		return;
 }

 long long partition(long long a[],long long n,long long s )
 {
 long long pivot,p,t,i;
 pivot=n;
 p=s;
 for(i=s;i<n;i++)
 {
  if(a[i]<=a[pivot])
  {
  t=a[i];
  a[i]=a[p];
  a[p]=t;
  p++;
  }
 }
 t=a[p];
 a[p]=a[n];
 a[n]=t;

 return p;
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
	return (-*((const long *)b)+*((const long *)a));
}

void main(){
long long n,i,j,min,count;count=0;min;
scanf("%lld",&n);
long long a[n],b[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

qsort(a,n,sizeof(long long),cmp);

	for(i=0;i<n-1;i++)
	{
		if(abs(a[i]-a[i+1])<min){
			count=0;
		min=abs(a[i]-a[i+1]);}

		if(abs(a[i]-a[i+1])==min)
			count++;

	}

printf("%lld %lld\n",min,count);
exit(0);
}


#include<stdio.h>
#include<stdlib.h>
void quicksort(long long[],long long,long long);
 long long partition(long long [],long long,long long);
void main()
{
long long n,i,j,min,count;count=0;min=9000000000;
scanf("%lld",&n);
long long a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

quicksort(a,0,n-1);

for(i=0;i<n-1;i++)
{
	if((a[i+1]-a[i])<min)
	{
		min=a[i+1]-a[i];
	count=0;}
	if((a[i+1]-a[i])==min)
     count++;
}

printf("%lld %lld\n",min,count);
exit(0);
}

void quicksort(long long a[],long long s,long long e)
  {
	  long long p;
   if(s<e)
   {
    p=partition(a,e,s);
    quicksort(a,s,p-1);
	quicksort(a,p+1,e);
	}
	else
		return;
 }

 long long partition(long long a[],long long n,long long s )
 {
 long long pivot,p,t,i;
 pivot=n;
 p=s;
 for(i=s;i<n;i++)
 {
  if(a[i]<=a[pivot])
  {
  t=a[i];
  a[i]=a[p];
  a[p]=t;
  p++;
  }
 }
 t=a[p];
 a[p]=a[n];
 a[n]=t;

 return p;
}


#include<stdio.h>
#include<stdlib.h>
void main()
{
long long n,i,j,min,count;count=0;min=9000000000;
scanf("%lld",&n);
long long a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)

{
if(abs(a[i]-a[j])<min){
min=abs(a[i]-a[j]);
count=0;}

if(abs(a[i]-a[j])==min)
count++;

}
}

printf("%lld %lld\n",min,count);
exit(0);
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
	return (*((int*)b)-*((int*)a));
}

int absolute(int a,int b){
	if(a<b)
		return (b-a);
	else
return (a-b);}

void main(){
int n,i,j,min,count;count=0;min;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);

qsort(a,n,sizeof(int),cmp);

	for(i=0;i<n-1;i++)
	{
		if(absolute(a[i],a[i+1])<min){
			count=0;
		min=absolute(a[i],a[i+1]);}

		if(absolute(a[i],a[i+1])==min)
			count++;

	}

printf("%d %d\n",min,count);
exit(0);
}


#include<stdio.h>
#include<stdlib.h>
void quicksort(long long[],long long,long long);
 long long partition(long long [],long long,long long);
void main()
{
long long n,i,j,min,count;count=0;min;
scanf("%lld",&n);
long long a[n],b[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

quicksort(a,0,n-1);

for(i=0;i<n-1;i++)
	b[i]=a[i+1]-a[i];

	quicksort(b,0,n-2);

	min=b[0];

	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
		else
			break;
	}

printf("%lld %lld\n",min,count);
exit(0);
}

void quicksort(long long a[],long long s,long long e)
  {
	  long long p;
   if(s<e)
   {
    p=partition(a,e,s);
    quicksort(a,s,p-1);
	quicksort(a,p+1,e);
	}
	else
		return;
 }

 long long partition(long long a[],long long n,long long s )
 {
 long long pivot,p,t,i;
 pivot=n;
 p=s;
 for(i=s;i<n;i++)
 {
  if(a[i]<=a[pivot])
  {
  t=a[i];
  a[i]=a[p];
  a[p]=t;
  p++;
  }
 }
 t=a[p];
 a[p]=a[n];
 a[n]=t;

 return p;
}


#include<stdio.h>
#include<stdlib.h>
void quicksort(long long[],long long,long long);
 long long partition(long long [],long long,long long);
void main()
{
long long n,i,j,min,count;count=0;min=9000000000;
scanf("%lld",&n);
long long a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

quicksort(a,0,n-1);

for(i=0;i<n;i++)
{
	if((a[i+1]-a[i])<min)
	{
		min=a[i+1]-a[i];
	count=0;}
	if((a[i+1]-a[i])==min)
     count++;
}

printf("%lld %lld\n",min,count);
exit(0);
}

void quicksort(long long a[],long long s,long long e)
  {
	  long long p;
   if(s<e)
   {
    p=partition(a,e,s);
    quicksort(a,s,p-1);
	quicksort(a,p+1,e);
	}
	else
		return;
 }

 long long partition(long long a[],long long n,long long s )
 {
 long long pivot,p,t,i;
 pivot=n;
 p=s;
 for(i=s;i<n;i++)
 {
  if(a[i]<=a[pivot])
  {
  t=a[i];
  a[i]=a[p];
  a[p]=t;
  p++;
  }
 }
 t=a[p];
 a[p]=a[n];
 a[n]=t;

 return p;
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
	return (-*((const long *)b)+*((const long *)a));
}

void main(){
long long n,i,j,min,count;count=0;min;
scanf("%lld",&n);
long long a[n],b[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);

qsort(a,n,sizeof(long long),cmp);

for(i=0;i<n-1;i++)
	b[i]=a[i+1]-a[i];

	qsort(b,n-1,sizeof(long long),cmp);

	min=b[0];

	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
		else
			break;
	}

printf("%lld %lld\n",min,count);
exit(0);
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define INF 2000000010

int n,a[200010];
void sort(int l,int r);
void swap(int i,int j);

int main(void)
{
    //freopen("bus.in","r",stdin);
    //freopen("bus.out","w",stdout);
    scanf("%d",&n);
    int i;
    for(i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(1,n);
    int min=INF,cnt=0;
    for(i=1;i<n;i++)
        if(a[i+1]-a[i]<min)
        {
            min=a[i+1]-a[i];
            cnt=1;
        }
        else if(a[i+1]-a[i]==min) cnt++;
    printf("%d %d\n",min,cnt);
    return 0;
}

void sort(int l,int r)
{
    if(l>=r) return;
    int i=l,j=r-1,x=rand()%(r-l+1)+l;
    swap(x,r);
    while(i<=j)
    {
        while(i<=j&&a[i]<a[r]) i++;
        if(i<=j) swap(i,j--);
        while(i<=j&&a[j]>a[r]) j--;
        if(i<=j) swap(i++,j);
    }
    swap(i,r);
    sort(l,i-1);  sort(i+1,r);
}

void swap(int i,int j)
{
    int t=a[i];  a[i]=a[j];  a[j]=t;
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void*i, const void*j){
    return *(int*)i-*(int*)j;
}
int main(void)
{
    int n;
    scanf("%d", &n);
    int arr[n];
    int i;
    for(i=0; i<n; ++i){
        scanf("%d", &arr[i]);
    }
    qsort(arr, n, 4, cmp);
    int j;
    int d=abs(arr[0]-arr[1]);
    int cnt=1;
    int d1;
    for(i=1; i<n-1; ++i){
        d1=abs(arr[i]-arr[i+1]);
        if(d1==d){
            ++cnt;
        }
        else if(d1<d){
            d=d1;
            cnt=1;
        }
    }
    printf("%d %d", d, cnt);
}


#include<stdio.h>
#include<stdlib.h>

int arr[200000];
int t[200000];

void combine(int low, int mid, int high){
    int i;
    int l=low, r=mid+1;
    for(i=0; l<=mid && r<=high; ++i){
        if(arr[l]<=arr[r]){
            t[i]=arr[l++];
        }
        else{
            t[i]=arr[r++];
        }
    }
    if(l<=mid){
        while(l<=mid){
            t[i++]=arr[l++];
        }
    }
    else{
        while(r<=high){
            t[i++]=arr[r++];
        }
    }
    for(i=low; i<=high; ++i){
        arr[i]=t[i-low];
    }
}
void msort(int low, int high){
    if(low<high){
        int mid=(low+high)/2;
        msort(low, mid);
        msort(mid+1, high);
        combine(low, mid, high);
    }
}
int main(void)
{
    int n;
    scanf("%d", &n);

    int i;
    for(i=0; i<n; ++i){
        scanf("%d", &arr[i]);
    }
    msort(0, n-1);

    int j;
    int d=abs(arr[0]-arr[1]);
    int cnt=1;
    int d1;
    for(i=1; i<n-1; ++i){
        d1=abs(arr[i]-arr[i+1]);
        if(d1==d){
            ++cnt;
        }
        else if(d1<d){
            d=d1;
            cnt=1;
        }
    }
    printf("%d %d", d, cnt);
}


#include <stdio.h>
#include <stdlib.h>

typedef int DataType_t;

void BinaryHeapPush(DataType_t *array, int *len, DataType_t val)
{
    ++(*len);
    int now = *len;
    while(now > 1 && val > array[now >> 1]) {
        array[now] = array[now >> 1];
        now >>= 1;
    }
    array[now] = val;
}

DataType_t BinaryHeapPop(DataType_t *array, int *len)
{
    DataType_t ret = array[1];
    int now = 1, temp;
    while((now << 1) <= *len) {
        temp = now << 1;
        if((temp + 1) <= *len && array[temp + 1] > array[temp]) {
            ++temp;
        }
        if(array[temp] > array[*len]) {
            array[now] = array[temp];
        } else {
            break;
        }
        now = temp;
    }
    array[now] = array[*len];
    --(*len);
    return ret;
}

void BinaryHeapSort(DataType_t *array, int len)
{
    while(len) {
        int curIdx = len;
        array[curIdx] = BinaryHeapPop(array, &len);
    }
}

int A[200001];

int main()
{
    int n, num, len = 0, min, cnt = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &num);
        BinaryHeapPush(A, &len, num);
    }
    BinaryHeapSort(A, n);
    min = A[2] - A[1];
    for(int i = 3; i <= n; ++i) {
        if(min > A[i] - A[i - 1]) {
            min = A[i] - A[i - 1];
        }
    }
    for(int i = 2; i <= n; ++i) {
        if(min == A[i] - A[i - 1]) {
            ++cnt;
        }
    }
    printf("%d %d\n", min, cnt);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

typedef int DataType_t;

void BinaryHeapPush(DataType_t *array, int *len, DataType_t val)
{
    ++(*len);
    int now = *len;
    while(now > 1 && val > array[now >> 1]) {
        array[now] = array[now >> 1];
        now >>= 1;
    }
    array[now] = val;
}

DataType_t BinaryHeapPop(DataType_t *array, int *len)
{
    DataType_t ret = array[1];
    int now = 1, temp;
    while((now << 1) <= *len) {
        temp = now << 1;
        if((temp + 1) <= *len && array[temp + 1] > array[temp]) {
            ++temp;
        }
        if(array[temp] > array[*len]) {
            array[now] = array[temp];
        } else {
            break;
        }
        now = temp;
    }
    array[now] = array[*len];
    --(*len);
    return ret;
}

void BinaryHeapSort(DataType_t *array, int len)
{
    while(len) {
        int curIdx = len;
        array[curIdx] = BinaryHeapPop(array, &len);
    }
}

int A[200001];

int main()
{
    int n, num, len = 0, min, cnt;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &num);
        BinaryHeapPush(A, &len, num);
    }
    BinaryHeapSort(A, n);
    min = A[2] - A[1];
    for(int i = 3; i <= n; ++i) {
        if(min > A[i] - A[i - 1]) {
            min = A[i] - A[i - 1];
        }
    }
    for(int i = 2; i <= n; ++i) {
        if(min == A[i] - A[i - 1]) {
            ++cnt;
        }
    }
    printf("%d %d\n", min, cnt);
    return 0;
}


#include <stdio.h>

void mergeSort(int [], int, int, int);
void partition(int [],int, int);

int main()
{
    //int list[50];
    int i, size,min,count=0;

    //printf("Enter total number of elements:");
    scanf("%d", &size);
    int list[size];
    //printf("Enter the elements:\n");
    for(i = 0; i < size; i++)
    {
         scanf("%d", &list[i]);
    }
    partition(list, 0, size - 1);
    min=list[1]-list[0];
    //printf("After merge sort:\n");
    for(i=0;i<size-1;i++)
    {
        if((list[i+1]-list[i])<min)
        min=list[i+1]-list[i];
    }
    for(i=0;i<size-1;i++)
        if(min==list[i+1]-list[i])
        count++;
    printf("%d %d",min,count);
    /*for(i = 0;i < size; i++)
    {
         printf("%d ",list[i]);
    }*/

   return 0;
}

void partition(int list[],int low,int high)
{
    int mid;

    if(low < high)
    {
        mid = (low + high) / 2;
        partition(list, low, mid);
        partition(list, mid + 1, high);
        mergeSort(list, low, mid, high);
    }
}

void mergeSort(int list[],int low,int mid,int high)
{
    int i, mi, k, lo, temp[200000];

    lo = low;
    i = low;
    mi = mid + 1;
    while ((lo <= mid) && (mi <= high))
    {
        if (list[lo] <= list[mi])
        {
            temp[i] = list[lo];
            lo++;
        }
        else
        {
            temp[i] = list[mi];
            mi++;
        }
        i++;
    }
    if (lo > mid)
    {
        for (k = mi; k <= high; k++)
        {
            temp[i] = list[k];
            i++;
        }
    }
    else
    {
        for (k = lo; k <= mid; k++)
        {
             temp[i] = list[k];
             i++;
        }
    }

    for (k = low; k <= high; k++)
    {
        list[k] = temp[k];
    }
}


#include <stdio.h>

void mergeSort(int [], int, int, int);
void partition(int [],int, int);

int main()
{
    //int list[50];
    int i, size,min,count=0;

    //printf("Enter total number of elements:");
    scanf("%d", &size);
    int list[size];
    //printf("Enter the elements:\n");
    for(i = 0; i < size; i++)
    {
         scanf("%d", &list[i]);
    }
    partition(list, 0, size - 1);
    min=list[1]-list[0];
    //printf("After merge sort:\n");
    for(i=0;i<size-1;i++)
    {
        if((list[i+1]-list[i])<min)
        min=list[i+1]-list[i];
    }
    for(i=0;i<size-1;i++)
        if(min==list[i+1]-list[i])
        count++;
    printf("%d %d",min,count);
    /*for(i = 0;i < size; i++)
    {
         printf("%d ",list[i]);
    }*/

   return 0;
}

void partition(int list[],int low,int high)
{
    int mid;

    if(low < high)
    {
        mid = (low + high) / 2;
        partition(list, low, mid);
        partition(list, mid + 1, high);
        mergeSort(list, low, mid, high);
    }
}

void mergeSort(int list[],int low,int mid,int high)
{
    int i, mi, k, lo, temp[50];

    lo = low;
    i = low;
    mi = mid + 1;
    while ((lo <= mid) && (mi <= high))
    {
        if (list[lo] <= list[mi])
        {
            temp[i] = list[lo];
            lo++;
        }
        else
        {
            temp[i] = list[mi];
            mi++;
        }
        i++;
    }
    if (lo > mid)
    {
        for (k = mi; k <= high; k++)
        {
            temp[i] = list[k];
            i++;
        }
    }
    else
    {
        for (k = lo; k <= mid; k++)
        {
             temp[i] = list[k];
             i++;
        }
    }

    for (k = low; k <= high; k++)
    {
        list[k] = temp[k];
    }
}


#include<stdio.h>

void divide(long long int a[200005],int low,int high);
void merge(long long int a[200005],int low,int mid,int high);

int main()
{
	long long int a[200005],ans=2000000001,diff;
	int d,n,m,i,count=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	divide(a,0,n-1);
	for(i=1;i<n;i++)
	{
		diff=a[i]-a[i-1];
		if(diff<ans)
		{
			ans=diff;
			count=1;
		}
		else if(diff ==ans)
			count++;
	}
	printf("%lld %d\n",ans,count);
	return 0;
}

void divide(long long int a[200005],int low,int high)
{
	int mid;
	if(low<high)
	{
		mid=(low+high)/2;
		divide(a,low,mid);
		divide(a,mid+1,high);
		merge(a,low,mid,high);
	}
}

void merge(long long int a[200005],int low,int mid,int high)
{
	long long int temp[200005];
	int i,l,m,k;
	l=low;
	i=low;
	m=mid+1;
	while(l<=mid && m<=high)
	{
		if(a[l]<=a[m])
		{
			temp[i]=a[l];
			l++;
		}
		else
		{
			temp[i]=a[m];
			m++;
		}
		i++;
	}
	if(l>mid)
	{
		for(k=m;k<=high;k++)
		{
			temp[i]=a[k];
			i++;
		}
	}
	else
	{
		for(k=l;k<=mid;k++)
		{
			temp[i]=a[k];
			i++;
		}
	}
	for(k=low;k<=high;k++)
	{
		a[k]=temp[k];
	}
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int main( )
{
	int n,i,j,k,co=0;
	int a[200005],x,min=0,t;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d",&a[j]);
	}
	min=fabs(a[1]-a[0]);
	t=min;
	qsort(a,n,sizeof(int),sai);
	for(j=1;j<n;j++)
	{
		x=a[j]-a[j-1];
		x=fabs(x);
		if(x<min)
		{
			min=x;
			co=1;
		}
		else if(x==min)
		{
			co+=1;
		}
	}
	printf("%d %d\n",min,co);
	return 0;
}


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int cmp(const void *a,const void *b){
	return *((const long *)b)-*((const long *)a);
}

int main(){
	int n,i;
	scanf("%d",&n);
	long a[n];

	for(i=0;i<n;i++){
		scanf("%ld",a+i);
	}

	qsort(a,n,sizeof(long),cmp);

	long min_dist=LONG_MAX;
	int num_min_pair=0;

	for(i=0;i<n-1;i++){
		if(a[i]-a[i+1]<min_dist){
			min_dist=a[i]-a[i+1];
			num_min_pair=1;
		}else if(a[i]-a[i+1]==min_dist){
			num_min_pair++;
		}
	}

	printf("%ld %d\n",min_dist,num_min_pair);

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int main( )
{
	int n,i,j,k,co=0;
	int a[200005];
        long long int min=99999999999999999;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d",&a[j]);
	}
	qsort(a,n,sizeof(int),sai);
	for(j=1;j<n;j++)
	{
		if((long long int)a[j]-(long long int)a[j-1]<=min)
		{
			min=a[j]-a[j-1];
		}
	}
	for(j=1;j<n;j++)
	{
		if((long long int)a[j]-(long long int)a[j-1]==min)
		{
			co+=1;
		}
	}
	printf("%lld %d\n",min,co);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int main( )
{
	int n,i,j,k,co=0;
	int a[200005],min=999999999;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d",&a[j]);
	}
	qsort(a,n,sizeof(int),sai);
	for(j=1;j<n;j++)
	{
		if(a[j]-a[j-1]<=min)
		{
			min=a[j]-a[j-1];
		}
	}
	for(j=1;j<n;j++)
	{
		if(a[j]-a[j-1]==min)
		{
			co+=1;
		}
	}
	printf("%d %d\n",min,co);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(long long int*)a-*(long long int*)b;
}
int main( )
{
	int n,i,j,k,co=0;
	long long int a[200005],b[200005];
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%lld",&a[j]);
		b[j]=0;
	}
	qsort(a,n,sizeof(long long int),sai);
	for(j=1;j<n;j++)
	{
		b[j-1]=a[j]-a[j-1];

	}
	qsort(b,n-1,sizeof(long long int),sai);
	for(j=0;j<n;j++)
	{
		if(b[j]==b[0])
		{
			co+=1;
		}
	}
	printf("%lld %d\n",b[0],co);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(long long int*)a-*(long long int*)b;
}
int main( )
{
	int n,i,j,k,co=0;
	long long int a[200005],b[200005],min=2000000005;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%lld",&a[j]);
		b[j]=0;
	}
	qsort(a,n,sizeof(long long int),sai);
	for(j=1;j<n;j++)
	{
		b[j-1]=a[j]-a[j-1];

	}
	for(j=0;j<n-1;j++)
	{
		if(b[j]<=min)
		{
			min=b[j];
		}
	}
	for(j=0;j<n-1;j++)
	{
		if(b[j]==min)
		{
			co+=1;
		}
	}
	printf("%lld %d\n",min,co);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int main( )
{
	int n,i,j,k,co=1;
	int a[200005],x,min=0,t;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d",&a[j]);
	}
	min=fabs(a[1]-a[0]);
	t=min;
	qsort(a,n,sizeof(int),sai);
	for(j=1;j<n;j++)
	{
		x=a[j]-a[j-1];
		x=fabs(x);
		if(x<min)
		{
			min=x;
			co=1;
		}
		else if(x==min)
		{
			co+=1;
		}
	}
	if(min==t)
	{
		co--;
	}
	printf("%d %d\n",min,co);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int sai(const void *a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int main( )
{
	int n,i,j,k,co=1;
	int a[200005],x,min=0,t;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d",&a[j]);
	}
	min=a[1]-a[0];
	if(min<0)
	{
		min=-min;
	}
	t=min;
	qsort(a,n,sizeof(int),sai);
	for(j=1;j<n;j++)
	{
		x=a[j]-a[j-1];
		x=fabs(x);
		if(x<min)
		{
			min=x;
			co=1;
		}
		else if(x==min)
		{
			co+=1;
		}
	}
	if(min==t)
	{
		co--;
	}
	printf("%d %d\n",min,co);
	return 0;
}


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int cmp(const void *a,const void *b){
	return *((const long *)b)-*((const long *)a);
}

int main(){
	int n,i;
	scanf("%d",&n);
	long a[n];

	for(i=0;i<n;i++){
		scanf("%ld",a+i);
	}

	qsort(a,n,sizeof(long),cmp);

	long min_dist=LONG_MAX;
	int num_min_pair=0;

	for(i=0;i<n-1;i++){
		if(a[i]-a[i+1]<min_dist){
			min_dist=a[i]-a[i+1];
			num_min_pair=1;
		}else if(a[i]-a[i+1]==min_dist){
			num_min_pair++;
		}
	}

	printf("%ld %d\n",min_dist,num_min_pair);

    return 0;
}


#include<stdio.h>
void merge(long long int a[200005],int initial,int middle,int end)
{

    long long int new[200005];
    int m,n,c,l,p,q,x;
    m=initial;
    n=middle+1;
    c=initial;
    while(m<=middle && n<=end)
    {
        if(a[m]>=a[n])
        {
            new[c]=a[n];
            n++;
        }
        else
        {
            new[c]=a[m];
            m++;
        }
        c++;
    }
    if(m>middle)
        for(l=n;l<=end;l++)
        {
            new[c]=a[l];
            c++;
        }
    else
        for(l=m;l<=middle;l++)
        {
            new[c]=a[l];
            c++;
        }
    for(x=initial;x<=end;x++)
    {
        a[x]=new[x];
    }
}
void  sort(long long int a[200005],int leftind,int rightind)
{
    int mid;
    if(leftind<rightind)
    {
        mid=(leftind+rightind)/2;
        sort(a,leftind,mid);
        sort(a,mid+1,rightind);
        merge(a,leftind,mid,rightind);
    }
    return ;
}
int main()
{
    int n,i,count=0;
    long long int a[200005],min=2000000001,s;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);
    sort(a,0,n-1);
   // for(i=0;i<n-1;i++)
  //      printf("%lld ",a[i]);
//    printf("%lld\n",a[n-1]);
    for(i=0;i<n-1;i++)
    {
        s=a[i+1]-a[i];
        if(s<min)
        {
            min=s;
            count=1;
        }
        else if(s==min)
        {
            count++;
        }
    }
    printf("%lld %d\n",min,count);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>

int a[200005],b[200005];

void merging(int low, int mid, int high) {
   int l1, l2, i;

   for(l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++) {
      if(a[l1] <= a[l2])
         b[i] = a[l1++];
      else
         b[i] = a[l2++];
   }

   while(l1 <= mid)
      b[i++] = a[l1++];

   while(l2 <= high)
      b[i++] = a[l2++];

   for(i = low; i <= high; i++)
      a[i] = b[i];
}

void sort(int low, int high) {
   int mid;

   if(low < high) {
      mid = (low + high) / 2;
      sort(low, mid);
      sort(mid+1, high);
      merging(low, mid, high);
   } else {
      return;
   }
}
int main()
{
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(0,n-1);
	int min=2000000009;
	for(i=0;i<n-1;i++)
	{
		b[i]=a[i+1]-a[i];
		if(b[i]<min)
			min=b[i];
	}
	int count=0;
	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
	}
	printf("%d %d",min,count);
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b)
{
	return *(int *)a-*(int *)b;
}
int main()
{
	int i,n,a[200005],b[200005];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),cmp);
	int min=1000000009;
	for(i=0;i<n-1;i++)
	{
		b[i]=a[i+1]-a[i];
		if(b[i]<min)
			min=b[i];
	}
	int count=0;
	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
	}
	printf("%d %d",min,count);
}


#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b)
{
	return *(int *)a-*(int *)b;
}
int main()
{
	int i,n,a[200005],b[200005];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),cmp);
	int min=2000000009;
	for(i=0;i<n-1;i++)
	{
		b[i]=a[i+1]-a[i];
		if(b[i]<min)
			min=b[i];
	}
	int count=0;
	for(i=0;i<n-1;i++)
	{
		if(b[i]==min)
			count++;
	}
	printf("%d %d",min,count);
}


#include <stdio.h>
#include <stdlib.h>
int absolute(int a, int b)
{
	if(a>=b)
		return (a-b);
	else
		return (b-a);
}
int cmp(const void *a, const void *b)
{
	return (*(int*)b - *(int*)a);
}
int main()
{
	int n,i;
	scanf("%d",&n);
	int arr[n];
	for(i=0;i<n;i++)
		scanf("%d",&arr[i]);
	qsort(arr,n,sizeof(int),cmp);
	// for(i=0;i<n;i++)
	// printf("%d\n",arr[i]);
	int mindiff=absolute(arr[0],arr[1]),count=0;
	// printf("%d\n",mindiff);
	for(i=0;i<n-1;i++)
	{
		if(absolute(arr[i],arr[i+1])==mindiff)
		{
			count++;
		}
		if(absolute(arr[i],arr[i+1])<mindiff)
		{
			count=1;
			mindiff=absolute(arr[i],arr[i+1]);
		}
	}
	printf("%d %d\n",mindiff,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

void merge(int a[],int l,int m,int h)
{

    int i=l,j=m+1,k=l,t[50005];
    while(i<=m&&j<=h)
    {
        if(a[i]<a[j])
            t[k++]=a[i++];
        else t[k++]=a[j++];

    }
    while(i<=m)
         t[k++]=a[i++];
         while(j<=h)
         t[k++]=a[j++];
         for(i=l;i<=h;i++)
            a[i]=t[i];

}
void msort(int a[],int l,int h)
{

    int m;
    if(l<h)
    {

        m=l+(h-l)/2;
        msort(a,l,m);
        msort(a,m+1,h);
        merge(a,l,m,h);
    }
}
main()
{

    int i,j,k,l,m,n,*a,s,min;
    scanf("%d",&n);
    a=(int *)malloc(sizeof(int )*n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    msort(a,0,n-1);

     min=INT_MAX,s=0;
    for(i=n-1;i>0;i--)
        if(a[i]-a[i-1]<min)
        {
            min=a[i]-a[i-1];s=1;
        }
        else if(a[i]-a[i-1]==min)
        {

            s++;
        }
        printf("%d %d\n",min,s);

}


#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

void merge(int a[],int l,int m,int h)
{

    int i=l,j=m+1,k=l,t[500005];
    while(i<=m&&j<=h)
    {
        if(a[i]<a[j])
            t[k++]=a[i++];
        else t[k++]=a[j++];

    }
    while(i<=m)
         t[k++]=a[i++];
         while(j<=h)
         t[k++]=a[j++];
         for(i=l;i<=h;i++)
            a[i]=t[i];

}
void msort(int a[],int l,int h)
{

    int m;
    if(l<h)
    {

        m=l+(h-l)/2;
        msort(a,l,m);
        msort(a,m+1,h);
        merge(a,l,m,h);
    }
}
main()
{

    int i,j,k,l,m,n,*a,s,min;
    scanf("%d",&n);
    a=(int *)malloc(sizeof(int )*n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    msort(a,0,n-1);

     min=INT_MAX,s=0;
    for(i=n-1;i>0;i--)
        if(a[i]-a[i-1]<min)
        {
            min=a[i]-a[i-1];s=1;
        }
        else if(a[i]-a[i-1]==min)
        {

            s++;
        }
        printf("%d %d\n",min,s);

}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>

void merge(int arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    int L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

void mergeSort(int arr[], int l, int r)
{
    if (l < r)
    {
        int m = l+(r-l)/2;
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);
        merge(arr, l, m, r);
    }
}
int diff(int x, int y)
{
    if(x>y)
    {
        return x-y;
    }
    else
    {
        return y-x;
    }
}
int main()
{
    int n;
    scanf("%d",&n);
    int i,j,k;
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    mergeSort(a,0,n-1);
    int c[n-1];
    for(i=0;i<n-1;i++)
    {
        c[i]=diff(a[i],a[i+1]);
    }
    mergeSort(c,0,n-2);
    j=1;
    for(i=0;i<n-1;i++)
    {
        if(c[i]==c[i+1])
        {
            j++;
        }
        else
        {
            break;
        }
    }
    printf("%d %d",c[0],j);
}


#include<stdio.h>

void merge(int a[],int b[],int low,int mid,int high)
{
    int l1,l2,i;

    for(l1=low,l2=mid+1,i=low;l1<=mid&&l2<=high;i++){
        if(a[l1]<=a[l2])
            b[i]=a[l1++];
        else
            b[i]=a[l2++];
    }

    while(l1<=mid)
        b[i++]=a[l1++];
    while(l2<=high)
        b[i++]=a[l2++];

    for(i=low;i<=high;i++)
        a[i]=b[i];
}

void mergesort(int a[],int b[],int low,int high)
{
    int mid;
    if(low<high){
        mid=(low+high)/2;
        mergesort(a,b,low,mid);
        mergesort(a,b,mid+1,high);

        merge(a,b,low,mid,high);
    }
}

int main()
{
    int N,i,temp,count=1;
    scanf("%d",&N);
    int a[N],b[N];
    for(i=0;i<N;i++) {
        scanf("%d",&a[i]);
    }
    mergesort(a,b,0,N-1);

    for(i=0;i<N-1;i++) {
        if(i==0) {
            temp=abs(a[i]-a[i+1]);
        }
        else {
            if(temp>abs(a[i]-a[i+1])) {
                temp=abs(a[i]-a[i+1]);
            }
            else if(temp==abs(a[i]-a[i+1]))
                count++;
        }
    }
    printf("%d %d",temp,count);

    return 0;
}


#include<stdio.h>

void merge(int a[],int b[],int low,int mid,int high)
{
    int l1,l2,i;

    for(l1=low,l2=mid+1,i=low;l1<=mid&&l2<=high;i++){
        if(a[l1]<=a[l2])
            b[i]=a[l1++];
        else
            b[i]=a[l2++];
    }

    while(l1<=mid)
        b[i++]=a[l1++];
    while(l2<=high)
        b[i++]=a[l2++];

    for(i=low;i<=high;i++)
        a[i]=b[i];
}

void mergesort(int a[],int b[],int low,int high)
{
    int mid;
    if(low<high){
        mid=(low+high)/2;
        mergesort(a,b,low,mid);
        mergesort(a,b,mid+1,high);

        merge(a,b,low,mid,high);
    }
}

int main()
{
    int N,i,temp,count=1;
    scanf("%d",&N);
    int a[N],b[N];
    for(i=0;i<N;i++) {
        scanf("%d",&a[i]);
    }
    mergesort(a,b,0,N-1);

    for(i=0;i<N-1;i++) {
        if(i==0) {
            temp=abs(a[i]-a[i+1]);
        }
        else {
            if(temp>abs(a[i]-a[i+1])) {
                temp=abs(a[i]-a[i+1]);
                count=1;
            }
            else if(temp==abs(a[i]-a[i+1]))
                count++;
        }
    }
    printf("%d %d",temp,count);

    return 0;
}


#include<stdlib.h>
void sort(int*,int);
int main()
{
	int n,i,freq=0,min=2*1000000000;
	scanf("%d",&n);
	int coord[n];
	int diff[n-1];
	for(i=0;i<(n-1);i++)
	{
		scanf("%d ",&coord[i]);
	}
	scanf("%d",&coord[n-1]);
	sort(coord,n);
	for(i=0;i<(n-1);i++)
	{
		diff[i]=abs(coord[i]-coord[i+1]);
		if(diff[i]<min)
		{
			min=diff[i];
		}
	}
	for(i=0;i<n-1;i++)
	{
		if(diff[i]==min)
		freq++;
	}
	printf("%d %d\n",min,freq);
}
void sort(int*b,int size)
{
	int i,j,k,l;
	int temp;
	for(i=0;i<size;i++)
	{
		for(j=i+1;j<size;j++)
		{
			if(b[i]>b[j])
			{
				temp=b[j];
				for(k=j-1;k>=i;k--)
				{
					b[k+1]=b[k];
				}
				b[i]=temp;
			}
		}
	}
}


#include<stdio.h>
#include<stdlib.h>
void merge(int arr[], int l, int m, int r);
void mergeSort(int arr[], int l, int r);
int main()
{
	int n,i,freq=0,min=2*1000000000;
	scanf("%d",&n);
	int coord[n];
	int diff[n-1];
	for(i=0;i<(n-1);i++)
	{
		scanf("%d ",&coord[i]);
	}
	scanf("%d",&coord[n-1]);
	mergeSort(coord,0,(n-1));
	for(i=0;i<(n-1);i++)
	{
		diff[i]=abs(coord[i]-coord[i+1]);
		if(diff[i]<min)
		{
			min=diff[i];
		}
	}
	for(i=0;i<n-1;i++)
	{
		if(diff[i]==min)
		freq++;
	}
	printf("%d %d\n",min,freq);
}
void merge(int arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;
    int L[n1], R[n2];
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];
    i = 0;
    j = 0;
    k = l;
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

void mergeSort(int arr[], int l, int r)
{
    if (l < r)
    {

        int m = l+(r-l)/2;

        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}


#include<stdio.h>
#include<stdlib.h>

int compare (const void * a, const void * b)
{
        return( *(int *)a - *(int *)b);
}

int main(){
	int n;
	int a[21000];;
	int dist[21000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	qsort (a, n, sizeof(int), compare);
	for(i=0; i<n; i++) printf("%d\n",a[i]);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	qsort (dist, n-1, sizeof(int), compare);
	for(i=0; i<n-1; i++) printf("%d\n",dist[i]);
        min=dist[0];
	for(i=1; i<n-2; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int compare (const void * a, const void * b)
{
        return( *(int *)a - *(int *)b);
}

int main(){
	int n;
	int a[21000];;
	int dist[21000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	qsort (a, n, sizeof(int), compare);
	for(i=0; i<n; i++) printf("%d\n",a[i]);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	qsort (dist, n-1, sizeof(int), compare);
	for(i=0; i<n-1; i++) printf("%d\n",dist[i]);
        min=dist[0];
	for(i=1; i<n-2; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%I64d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int compare (const void * a, const void * b)
{
        return( *(int *)a - *(int *)b);
}

int main(){
	int n;
	int a[21000];;
	int dist[21000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	qsort (a, n, sizeof(int), compare);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	qsort (dist, n-1, sizeof(int), compare);
        min=dist[0];
	for(i=1; i<n-1; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int compare (const void * a, const void * b)
{
        return( *(int *)a - *(int *)b);
}

int main(){
	int n;
	int a[210000];;
	int dist[210000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	qsort (a, n, sizeof(int), compare);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	qsort (dist, n-1, sizeof(int), compare);
        min=dist[0];
	for(i=1; i<n-1; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

void swap(long long v[], int i, int j)
{
	int temp;
	temp=v[i];
	v[i]=v[j];
	v[j]=temp;
}

void myqsort(long long v[], int left, int right){
	int i, last;
	void swap(long long v[], int i, int j);
	if(left >= right)
		return;
	swap(v, left, (left+right)/2);
	last = left;
	for (i=left+1; i<=right; i++)
		if (v[i] < v[left])
			swap(v, ++last, i);
	swap(v, left, last);
	myqsort(v, left, last-1);
	myqsort(v, last+1, right);
}

int main(){
	int n;
	long long a[21000];;
	long long dist[21000];
	int i;
	int j;
	long long min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%lld",&a[i]);
	myqsort(a, 0, n-1);

	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	myqsort(dist, 0, n-2);
        min=dist[0];
	for(i=1; i<n-1; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%I64d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

// Merge sort routine from http://www.cprogramming.com/tutorial/computersciencetheory/merge.html
int max(int x, int y)
{
	if(x>y){
		return x;
	}else{
		return y;
	}
}

void merge_helper(int *input, int left, int right, int *scratch)
{
	if(right == left + 1){
		return;
	}else{
		int i=0;
		int length = right - left;
		int midpoint_distance = length/2;
		int l = left, r = left + midpoint_distance;

		merge_helper(input, left, left + midpoint_distance, scratch);
		merge_helper(input, left + midpoint_distance, right, scratch);
		for(i=0; i < length; i++)
		{
			if( l < left + midpoint_distance &&
					(r == right || max(input[l], input[r]) == input[l]))
			{
				scratch[i] = input[l];
				l++;
			}else{
				scratch[i] = input[r];
				r++;
			}
		}
		for(i = left; i < right; i++)
		{
			input[i] = scratch[i-left];
		}
	}
}

int mergesort(int *input, int size)
{
	int *scratch = (int *)malloc(size * sizeof(int));
	if(scratch != NULL)
	{
		merge_helper(input, 0, size, scratch);
		free(scratch);
		return 1;
	}else{
		return 0;
	}
}

int main(){
	int n;
	int a[210000];;
	int dist[210000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	mergesort (a, n);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	mergesort (dist, n-1);
        min=dist[0];
	for(i=1; i<n-1; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

// Merge sort routine from http://www.cprogramming.com/tutorial/computersciencetheory/merge.html
int max(int x, int y)
{
	if(x>y){
		return x;
	}else{
		return y;
	}
}

void merge_helper(int *input, int left, int right, int *scratch)
{
	if(right == left + 1){
		return;
	}else{
		int i=0;
		int length = right - left;
		int midpoint_distance = length/2;
		int l = left, r = left + midpoint_distance;

		merge_helper(input, left, left + midpoint_distance, scratch);
		merge_helper(input, left + midpoint_distance, right, scratch);
		for(i=0; i < length; i++)
		{
			if( l < left + midpoint_distance &&
					(r == right || max(input[l], input[r]) == input[l]))
			{
				scratch[i] = input[l];
				l++;
			}else{
				scratch[i] = input[r];
				r++;
			}
		}
		for(i = left; i < right; i++)
		{
			input[i] = scratch[i-left];
		}
	}
}

int mergesort(int *input, int size)
{
	int *scratch = (int *)malloc(size * sizeof(int));
	if(scratch != NULL)
	{
		merge_helper(input, 0, size, scratch);
		free(scratch);
		return 1;
	}else{
		return 0;
	}
}

int main(){
	int n;
	int a[210000];;
	int dist[210000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	mergesort (a, n);
	for(i=0; i<n-1; i++) dist[i]=a[i]-a[i+1];
	mergesort (dist, n-1);
        min=dist[n-2];
	for(i=1; i<n-1; i++)
	{
		if(dist[n-2-i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int compare (const void * a, const void * b)
{
        return( *(long long *)a - *(long long *)b);
}

int main(){
	int n;
	long long a[21000];;
	long long dist[21000];
	int i;
	int j;
	long long min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%lld",&a[i]);
	qsort (a, n, sizeof(long long), compare);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	qsort (dist, n-1, sizeof(long long), compare);
        min=dist[0];
	for(i=1; i<n-2; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%I64d %d\n",min,count);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int compare (const void * a, const void * b)
{
        return( *(int *)a - *(int *)b);
}

int main(){
	int n;
	int a[21000];;
	int dist[21000];
	int i;
	int j;
	int min;
	int count=1;

	scanf("%d",&n);

	for(i=0; i<n; i++) scanf("%d",&a[i]);
	qsort (a, n, sizeof(int), compare);
	for(i=0; i<n-1; i++) dist[i]=a[i+1]-a[i];
	qsort (dist, n-1, sizeof(int), compare);
        min=dist[0];
	for(i=1; i<n-2; i++)
	{
		if(dist[i]==min){
			count++;
		}else{
			exit;
		}
	}

	printf("%d %d\n",min,count);
	return 0;
}


#include <stdio.h>
void merge_sort(int* data,int _size){
    if(_size>1){
        int lsz=_size/2,rsz=_size-lsz;
        int data1[lsz],data2[rsz],i,j,k;
        for(i=0;i<lsz;i++){
            data1[i]=data[i];
        }
        j=0;
        for(;i<_size;i++){
            data2[j]=data[i];
            j++;
        }
        merge_sort(data1,lsz);
        merge_sort(data2,rsz);
        i=0;k=0;j=0;
        while(1){
            if(data1[j]<data2[k]){
                data[i]=data1[j];
                j++;
            }
            else{
                data[i]=data2[k];
                k++;
            }
            i++;
            if(j==lsz){
                for(;i<_size;i++){
                    data[i]=data2[k];
                    k++;
                }
                break;
            }
            if(k==rsz){
                for(;i<_size;i++){
                    data[i]=data1[j];
                    j++;
                }
                break;
            }
        }
        return;
    }
    return;
}
int main(){
    int *data,i,n,mn=1000000009,q=0,tmp;
    scanf("%d",&n);
    data=(int*)malloc(sizeof(int)*n);
    for(i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    merge_sort(data,n);
    for(i=0;i<n-1;i++){
        tmp=data[i+1]-data[i];
        if(tmp==mn){
            q++;
        }
        else if(tmp<mn){
            mn=tmp;
            q=1;
        }
    }
    printf("%d %d\n",mn,q);
    free(data);
    return 0;

}


#include <stdio.h>
void merge_sort(int* data,int _size){
    if(_size>1){
        int lsz=_size/2,rsz=_size-lsz;
        int data1[lsz],data2[rsz],i,j,k;
        for(i=0;i<lsz;i++){
            data1[i]=data[i];
        }
        j=0;
        for(;i<_size;i++){
            data2[j]=data[i];
            j++;
        }
        merge_sort(data1,lsz);
        merge_sort(data2,rsz);
        i=0;k=0;j=0;
        while(1){
            if(data1[j]<data2[k]){
                data[i]=data1[j];
                j++;
            }
            else{
                data[i]=data2[k];
                k++;
            }
            i++;
            if(j==lsz){
                for(;i<_size;i++){
                    data[i]=data2[k];
                    k++;
                }
                break;
            }
            if(k==rsz){
                for(;i<_size;i++){
                    data[i]=data1[j];
                    j++;
                }
                break;
            }
        }
        return;
    }
    return;
}
int main(){
    int *data,i,n,mn=1000000009,q=0,tmp;
    scanf("%d",&n);
    data=(int*)malloc(sizeof(int)*n);
    for(i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    merge_sort(data,n);
    for(i=0;i<n-1;i++){
        tmp=data[i+1]-data[i];
        if(tmp<mn){
            mn=tmp;
            q=1;
        }
        else if(tmp==mn){
            q++;
        }
    }
    printf("%d %d\n",mn,q);
    free(data);
    return 0;

}


#include <stdio.h>
void merge_sort(int* data,int _size){
    if(_size>1){
        int lsz=_size/2,rsz=_size-lsz;
        int data1[lsz],data2[rsz],i,j,k;
        for(i=0;i<lsz;i++){
            data1[i]=data[i];
        }
        j=0;
        for(;i<_size;i++){
            data2[j]=data[i];
            j++;
        }
        merge_sort(data1,lsz);
        merge_sort(data2,rsz);
        i=0;k=0;j=0;
        while(1){
            if(data1[j]<data2[k]){
                data[i]=data1[j];
                j++;
            }
            else{
                data[i]=data2[k];
                k++;
            }
            i++;
            if(j==lsz){
                for(;i<_size;i++){
                    data[i]=data2[k];
                    k++;
                }
                break;
            }
            if(k==rsz){
                for(;i<_size;i++){
                    data[i]=data1[j];
                    j++;
                }
                break;
            }
        }
        return;
    }
    return;
}
int main(){
    int *data,i,n,mn=2000000009,q=0,tmp;
    scanf("%d",&n);
    data=(int*)malloc(sizeof(int)*n);
    for(i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    merge_sort(data,n);
    for(i=0;i<n-1;i++){
        tmp=data[i+1]-data[i];
        if(tmp<mn){
            mn=tmp;
            q=1;
        }
        else if(tmp==mn){
            q++;
        }
    }
    printf("%d %d\n",mn,q);
    free(data);
    return 0;

}


#include<stdio.h>
#include<stdint.h>
int a[210000],t[210000];
void mergesort(int lo,int hi){
    int mid,i,j,k;
    if(lo==hi)
        return;
    mid=(lo+hi)/2;
    mergesort(lo,mid);
    mergesort(mid+1,hi);
    for(i=lo,j=mid+1,k=lo;k<=hi;k++){
        if(i==mid+1)
            t[k]=a[j++];
        else if(j==hi+1)
            t[k]=a[i++];
        else if(a[i]<a[j])
            t[k]=a[i++];
        else
            t[k]=a[j++];
    }
    for(k=lo;k<=hi;k++)
            a[k]=t[k];

}

int main()
{
    int64_t i,j,k,n,p=2200000000,d,l;
    scanf("%I64d",&n);
        for(i=0;i<n;i++)
            scanf("%I64d",&a[i]);

         mergesort(0,n-1);
         for(k=1;k<n;k++){
        d=a[k]-a[k-1];
                    if(d<=p){
                            if(d==p)
                            l++;
                    else{
                               p=d;
                               l=1;
                    }
                    }
    }
    printf("%I64d %I64d\n",p,l);

    return 0;
}


import java.util.*;
public class NewRoute

{
	public static void main(String args[])
	{
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		Integer a[]=new Integer[n];
		for(int i=0;i<n;i++)
			a[i]=ob.nextLong();
		Arrays.sort(a);
		int s=0;
		int min=Integer.MAX_VALUE;
		for(int i=0;i<n-1;i++)
		{
			if(Math.abs(a[i]-a[i+1])==min)
				s++;
			if(Math.abs(a[i]-a[i+1])<min)
			{
				min=Math.abs(a[i]-a[i+1]);
				s=1;
			}

		}
		System.out.println(min+" "+s);
	}
}


import java.util.*;
public class a792 {
        public static void main(String args[])
        {
            Scanner ob=new Scanner(System.in);
            int n=ob.nextInt();
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=ob.nextLong();
            Arrays.sort(a);
            int s=0;
            int min=Integer.MAX_VALUE;
            int c=0;
            for(int i=0;i<n-1;i++)
            {
                c=Math.abs(a[i]-a[i+1]);
                if(c==min)
                    s++;
                if(c<min)
                {
                    min=c;
                    s=1;
                }

            }
            System.out.println(min+" "+s);
        }
}


import java.util.*;
public class a792 {
        public static void main(String args[])
        {
            Scanner ob=new Scanner(System.in);
            int n=ob.nextInt();
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=ob.nextLong();
            Arrays.sort(a);
            int s=0;
            int min=Integer.MAX_VALUE;
            for(int i=0;i<n-1;i++)
            {
                if(Math.abs(a[i]-a[i+1])==min)
                    s++;
                if(Math.abs(a[i]-a[i+1])<min)
                {
                    min=Math.abs(a[i]-a[i+1]);
                    s=1;
                }

            }
            System.out.println(min+" "+s);
        }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.util.Arrays;
import java.util.Random;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Read in = new Read(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Read in, PrintWriter out) {
            int n = in.nextInt();
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            a = shuffle(a, new Random());
            Arrays.sort(a);
            int min = Integer.MAX_VALUE, f = 0;
            int curr = 0;
            for (int i = 0; i < n - 1; i++) {
                curr = Math.abs(a[i + 1] - a[i]);
                if (curr == min) {
                    f++;
                } else if (curr < min) {
                    min = curr;
                    f = 1;
                }
            }
            out.println(min + " " + f);
        }

        public static int[] shuffle(int[] a, Random gen) {
            for (int i = 0, n = a.length; i < n; i++) {
                int ind = gen.nextInt(n - i) + i;
                int d = a[i];
                a[i] = a[ind];
                a[ind] = d;
            }
            return a;
        }

    }

    static class Read {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public Read(InputStream inputStream) {
            din = new DataInputStream(inputStream);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Read(String file_name) {
            try {
                din = new DataInputStream(new FileInputStream(file_name));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() {
            try {
                bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

    }
}


import java.util.*;
public class a792 {
        public static void main(String args[])
        {
            Scanner ob=new Scanner(System.in);
            int n=ob.nextInt();
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=ob.nextLong();
            Arrays.sort(a);
            int s=0;
            long min=Integer.MAX_VALUE;
            for(int i=0;i<n-1;i++)
            {
                if(Math.abs(a[i]-a[i+1])==min)
                    s++;
                if(Math.abs(a[i]-a[i+1])<min)
                {
                    min=Math.abs(a[i]-a[i+1]);
                    s=1;
                }

            }
            System.out.println(min+" "+s);
        }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Read in = new Read(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Read in, PrintWriter out) {
            int n = in.nextInt();
            Integer a[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);
            int min = Integer.MAX_VALUE, f = 0;
            int curr = 0;
            for (int i = 0; i < n - 1; i++) {
                curr = Math.abs(a[i + 1] - a[i]);
                if (curr == min) {
                    f++;
                } else if (curr < min) {
                    min = curr;
                    f = 1;
                }
            }
            out.println(min + " " + f);
        }

    }

    static class Read {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public Read(InputStream inputStream) {
            din = new DataInputStream(inputStream);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Read(String file_name) {
            try {
                din = new DataInputStream(new FileInputStream(file_name));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() {
            try {
                bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

    }
}


import java.util.*;
public class NewRoute

{
	public static void main(String args[])
	{
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		Integer a[]=new Integer[n];
		for(int i=0;i<n;i++)
			a[i]=ob.nextInt();
		Arrays.sort(a);
		int s=0;
		int min=Integer.MAX_VALUE;
		for(int i=0;i<n-1;i++)
		{
			if(Math.abs(a[i]-a[i+1])==min)
				s++;
			if(Math.abs(a[i]-a[i+1])<min)
			{
				min=Math.abs(a[i]-a[i+1]);
				s=1;
			}

		}
		System.out.println(min+" "+s);
	}
}


import java.util.*;
public class a792 {
        public static void main(String args[])
        {
            Scanner ob=new Scanner(System.in);
            int n=ob.nextInt();
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=ob.nextLong();
            Arrays.sort(a);
            int s=0;
            long min=Integer.MAX_VALUE;
            long c=0;
            for(int i=0;i<n-1;i++)
            {
                c=Math.abs(a[i]-a[i+1]);
                if(c==min)
                    s++;
                if(c<min)
                {
                    min=c;
                    s=1;
                }

            }
            System.out.println(min+" "+s);
        }
}


import java.util.*;
public class a792
{
	public static void main(String args[])
	{
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		Int a[]=new Int[n];
		for(int i=0;i<n;i++)
			a[i]=ob.nextInt();
		Arrays.sort(a);
		int s=0;
		int min=Integer.MAX_VALUE;
		for(int i=0;i<n-1;i++)
		{
			if(Math.abs(a[i]-a[i+1])==min)
				s++;
			if(Math.abs(a[i]-a[i+1])<min)
			{
				min=Math.abs(a[i]-a[i+1]);
				s=1;
			}

		}

		System.out.println(min+" "+s);
	}
}