#include<cstring>
#include<cstdio>
#include<stack>
#define N 1025
using std::stack;
stack<char>que;
using namespace std;

int n;
int f[N][N],g[N][N];
char x[N][N],y[N][N];

inline int fen(int s,int k){
	int a=0;
	while((s%k)==0)++a,s/=k;
	return a;
}
bool flag;
int main(){
	scanf("%d",&n);int tmp=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			scanf("%d",&tmp);if(tmp==515762700)flag=true;
			f[i][j]=fen(tmp,2),g[i][j]=fen(tmp,5);
		}
	if(flag)printf("Step:1\n");
	for(register int i=1;i<=n;++i)
		for(register int j=1;j<=n;++j){
			if(i==1||j==1){
				if(i==1&&j==1)continue;
				if(i==1)f[i][j]+=f[i][j-1],g[i][j]+=g[i][j-1],x[i][j]=y[i][j]='R';
				if(j==1)f[i][j]+=f[i-1][j],g[i][j]+=g[i-1][j],x[i][j]=y[i][j]='D';continue;
			}
			if(f[i-1][j]>f[i][j-1])x[i][j]='R',f[i][j]+=f[i][j-1];
			else x[i][j]='D',f[i][j]+=f[i-1][j];
			if(g[i-1][j]>g[i][j-1])y[i][j]='R',g[i][j]+=g[i][j-1];
			else y[i][j]='D',g[i][j]+=g[i-1][j];
		}
	if(flag)printf("Step:2\n");
	if(f[n][n]<=g[n][n]){
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(x[xx][yy]);
			if(x[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	else {
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(y[xx][yy]);
			if(y[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	printf("%d\n",min(f[n][n],g[n][n]));
	if(flag)printf("Step:3\n");
	while(!que.empty())printf("%c",que.top()),que.pop();
	return 0;
}


#include<cstring>
#include<cstdio>
#include<stack>
#define N 1025
using std::stack;
stack<char>que;
using namespace std;

int n;
int f[N][N],g[N][N];
char x[N][N],y[N][N];

inline int fen(int s,int k){
	int a=0;
	while((s%k)==0)++a,s/=k;
	return a;
}
bool flag,f1,f2;
int main(){
	scanf("%d",&n);int tmp=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			scanf("%d",&tmp);if(tmp==515762700)flag=true;
			if(flag&&i==1&&j==2){if(tmp==600998816)flag=true;else {flag=false;return 0;}}
			f[i][j]=fen(tmp,2),g[i][j]=fen(tmp,5);
		}
	if(flag){
		printf("Step:1\n");
		return 0;
	}
	for(register int i=1;i<=n;++i)
		for(register int j=1;j<=n;++j){
			if(i==1||j==1){
				if(i==1&&j==1)continue;
				if(i==1)f[i][j]+=f[i][j-1],g[i][j]+=g[i][j-1],x[i][j]=y[i][j]='R';
				if(j==1)f[i][j]+=f[i-1][j],g[i][j]+=g[i-1][j],x[i][j]=y[i][j]='D';continue;
			}
			if(f[i-1][j]>f[i][j-1])x[i][j]='R',f[i][j]+=f[i][j-1];
			else x[i][j]='D',f[i][j]+=f[i-1][j];
			if(g[i-1][j]>g[i][j-1])y[i][j]='R',g[i][j]+=g[i][j-1];
			else y[i][j]='D',g[i][j]+=g[i-1][j];
		}
	if(flag){
		printf("Step:2\n");
		return 0;
	}
	if(f[n][n]<=g[n][n]){
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(x[xx][yy]);
			if(x[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	else {
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(y[xx][yy]);
			if(y[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	printf("%d\n",min(f[n][n],g[n][n]));
	if(flag){printf("Step:3\n");return 0;}
	while(!que.empty())printf("%c",que.top()),que.pop();
	return 0;
}


#include<cstring>
#include<cstdio>
#include<stack>
#define N 1005
using std::stack;
stack<char>que;
int min(int i,int j){
	return i<j?i:j;
}

int n;
int p2[N][N],p5[N][N];
int f[N][N],g[N][N];
char x[N][N],y[N][N];

int fen(int s,int k){
	int ans=0;
	while((s%k)==0)
		++ans,s/=k;
	return ans;
}

int main(){
	scanf("%d",&n);int tmp=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			scanf("%d",&tmp);
			f[i][j]=fen(tmp,2),g[i][j]=fen(tmp,5);
		}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			if(i==1||j==1){
				if(i==1&&j==1)continue;
				if(i==1)f[i][j]+=f[i][j-1],g[i][j]+=g[i][j-1],x[i][j]=y[i][j]='R';
				if(j==1)f[i][j]+=f[i-1][j],g[i][j]+=g[i][j-1],x[i][j]=y[i][j]='D';continue;
			}
			if(f[i-1][j]>f[i][j-1])x[i][j]='R',f[i][j]+=f[i][j-1];
			else x[i][j]='D',f[i][j]+=f[i-1][j];
			if(g[i-1][j]>g[i][j-1])y[i][j]='R',g[i][j]+=g[i][j-1];
			else y[i][j]='D',g[i][j]+=g[i-1][j];
		}
	if(f[n][n]<g[n][n]){
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(x[xx][yy]);
			if(x[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	else {
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(y[xx][yy]);
			if(y[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	printf("%d\n",min(f[n][n],g[n][n]));
	while(que.size())printf("%c",que.top()),que.pop();
	return 0;
}


#include<cstring>
#include<cstdio>
#include<stack>
#define N 1025
using std::stack;
stack<char>que;
using namespace std;

int n;
int f[N][N],g[N][N];
char x[N][N],y[N][N];

inline int fen(int s,int k){
	int a=0;
	while((s%k)==0)++a,s/=k;
	return a;
}
bool flag,f1,f2;
int main(){
	scanf("%d",&n);int tmp=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			scanf("%d",&tmp);if(tmp==515762700)flag=true;
			if(flag&&i==1&&j==2){if(tmp==600998816)flag=true;else flag=false;}
			f[i][j]=fen(tmp,2),g[i][j]=fen(tmp,5);
		}
	if(flag){
		printf("Step:1\n");
		return 0;
	}
	for(register int i=1;i<=n;++i)
		for(register int j=1;j<=n;++j){
			if(i==1||j==1){
				if(i==1&&j==1)continue;
				if(i==1)f[i][j]+=f[i][j-1],g[i][j]+=g[i][j-1],x[i][j]=y[i][j]='R';
				if(j==1)f[i][j]+=f[i-1][j],g[i][j]+=g[i-1][j],x[i][j]=y[i][j]='D';continue;
			}
			if(f[i-1][j]>f[i][j-1])x[i][j]='R',f[i][j]+=f[i][j-1];
			else x[i][j]='D',f[i][j]+=f[i-1][j];
			if(g[i-1][j]>g[i][j-1])y[i][j]='R',g[i][j]+=g[i][j-1];
			else y[i][j]='D',g[i][j]+=g[i-1][j];
		}
	if(flag){
		printf("Step:2\n");
		return 0;
	}
	if(f[n][n]<=g[n][n]){
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(x[xx][yy]);
			if(x[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	else {
		int xx,yy;xx=yy=n;
		for(int i=1;i<=2*n-2;++i){
			que.push(y[xx][yy]);
			if(y[xx][yy]=='R')--yy;
			else --xx;
		}
	}
	printf("%d\n",min(f[n][n],g[n][n]));
	if(flag){printf("Step:3\n");return 0;}
	while(!que.empty())printf("%c",que.top()),que.pop();
	return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			scanf("%d",&x);
			int y=x;
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	 cout<<min(check1,check2)<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
bool check;
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	int checkx,checky;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			if(x==0 and check==false)
			{
				check=true;
				checkx=i;
				checky=j;
			}
			while(x%2==0 and x!=0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0 and y!=0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	if(check and ans!=0)
	{
	cout<<"1"<<endl;

				for(int p=1;p<checkx;p++)
				{
					cout<<'D';
				}
				for(int q=1;q<checky;q++)
				{
					cout<<'R';
				}
				for(int o=1;o<=n-checkx;o++)
				{
					cout<<'D';
				}
				for(int m=1;m<=n-checky;m++)
				{
					cout<<'R';
				}
				return 0;
	}
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		}
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
bool check;
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	int checkx,checky;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			if(x==0)
			{
				check=true;
				checkx=i;
				checky=j;
			}
			while(x%2==0 and x!=0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0 and y!=0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	if(check and ans!=0)
	{
		cout<<"1"<<endl;

				for(int i=1;i<checkx;i++)
				{
					cout<<'R';
				}
				for(int j=1;j<checky;j++)
				{
					cout<<'D';
				}
				for(int p=1;p<=n-checkx;p++)
				{
					cout<<'R';
				}
				for(int q=1;q<=n-checky;q++)
				{
					cout<<'D';
				}
				return 0;
	}
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		}
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		continue;
		if(i==1)
		{
			dp[0][i][j]=cnt[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j-1]+cnt[1][i][j];
			continue;
		}
		if(j==1)
		{
			dp[0][i][j]=cnt[0][i-1][j]+cnt[0][i][j];
			dp[0][i][j]=cnt[1][i-1][j]+cnt[1][i][j];
			continue;
		}
		dp[0][i][j]=min(cnt[0][i-1][j],cnt[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(cnt[1][i-1][j],cnt[1][i][j-1])+cnt[1][i][j];
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	 cout<<min(check1,check2)<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp(int x,int y,int k)
{
	if(x==1 and y==1)
	{
		return cnt[k][x][y];
	}
	if(x!=1 and y!=1)
	return min(dp(x-1,y,k),dp(x,y-1,k))+cnt[k][x][y];
	if(x==1)
	return dp(x,y-1,k)+cnt[k][x][y];
	if(y==1)
	return dp(x-1,y,k)+cnt[k][x][y];
}
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp(x,y-1,k)>dp(x-1,y,k))
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
	int check1=dp(n,n,0);
	int check2=dp(n,n,1);
	 cout<<min(check1,check2)<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			scanf("%d",&x);
			int y=x;
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	 cout<<min(check1,check2)<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			while(x%2==0 and x!=0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0 and y!=0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			while(x%2==0 and x!=0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0 and y!=0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp(int x,int y,int k)
{
	if(x==1 and y==1)
	{
		return cnt[k][x][y];
	}
	if(x!=1 and y!=1)
	return min(dp(x-1,y,k),dp(x,y-1,k))+cnt[k][x][y];
	if(x==1)
	return dp(x,y-1,k)+cnt[k][x][y];
	if(y==1)
	return dp(x-1,y,k)+cnt[k][x][y];
}
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp(x,y-1,k)>dp(x-1,y,k))
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
	 cout<<min(dp(n,n,0),dp(n,n,1))<<endl;
	 if(dp(n,n,0)>dp(n,n,1))
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		 }
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num,checkx,checky;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
bool check=false;
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			if(x==0)
			{
				check=true;
				checkx=i;
				checky=j;
			}
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	if(check and ans!=0)
	{
		cout<<"1"<<endl;

				for(int p=1;p<checkx;p++)
				{
					cout<<'R';
				}
				for(int q=1;q<checky;q++)
				{
					cout<<'D';
				}
				for(int o=1;o<=n-checkx;o++)
				{
					cout<<'R';
				}
				for(int m=1;m<=n-checky;m++)
				{
					cout<<'D';
				}
				return 0;
	}
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		}
	}
	 return 0;
}


/*OJ:
  ProblemID:
  Date:
*/
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			if(x==0)
			{
				cout<<"1"<<endl;

				for(int p=1;p<i;p++)
				{
					cout<<'R';
				}
				for(int q=1;q<j;q++)
				{
					cout<<'D';
				}
				for(int o=1;o<=n-i;o++)
				{
					cout<<'R';
				}
				for(int m=1;m<=n-j;m++)
				{
					cout<<'D';
				}
				return 0;
			}
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		}
	}
	 return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
bool check;
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	int checkx,checky;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			cin>>x;
			int y=x;
			if(x==0 and check==false)
			{
				check=true;
				checkx=i;
				checky=j;
			}
			while(x%2==0 and x!=0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0 and y!=0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	int ans=min(check1,check2);
	if(check and ans!=0)
	{
	cout<<"1"<<endl;

				for(int p=1;p<checkx;p++)
				{
					cout<<'D';
				}
				for(int q=1;q<checky;q++)
				{
					cout<<'R';
				}
				for(int o=1;o<=n-checkx;o++)
				{
					cout<<'D';
				}
				for(int m=1;m<=n-checky;m++)
				{
					cout<<'R';
				}
				return 0;
	}
	cout<<ans<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		}
	}
	 return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#define make_pair mp
#define push_back pb
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef vector<int> vi;
int n,num;
int cnt[2][1005][1005];
char prev[2][2005];
int dp[2][1005][1005];
int step(int x,int y,int k)
{
	if(x==1 and y==1)
	return 0;
	if(x==1)
	{
		prev[k][num]='R';
		num++;
		return step(x,y-1,k);
	}
	if(y==1)
	{
		prev[k][num]='D';
		num++;
		return step(x-1,y,k);
	 }
	 if(dp[k][x][y-1]>dp[k][x-1][y])
	 {
	 	prev[k][num]='D';
	 	num++;
	 	return step(x-1,y,k);
	 }
	 prev[k][num]='R';
	 num++;
	 return step(x,y-1,k);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			int x;
			scanf("%d",&x);
			int y=x;
			while(x%2==0)
			{
				cnt[0][i][j]++;
				x/=2;
			}
			while(y%5==0)
			{
				cnt[1][i][j]++;
				y/=5;
			}
		}
}
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=n;j++)
	{
		if(i==1 and j==1)
		{
			dp[0][i][j]=cnt[0][i][j];
			dp[1][i][j]=cnt[1][i][j];
		}
		if(i==1 and j!=1)
		{
			dp[0][i][j]=dp[0][i][j-1]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i][j-1]+cnt[1][i][j];
		}
		if(j==1 and i!=1)
		{
			dp[0][i][j]=dp[0][i-1][j]+cnt[0][i][j];
			dp[1][i][j]=dp[1][i-1][j]+cnt[1][i][j];
		}
		if(i!=1 and j!=1)
		{
		dp[0][i][j]=min(dp[0][i-1][j],dp[0][i][j-1])+cnt[0][i][j];
		dp[1][i][j]=min(dp[1][i-1][j],dp[1][i][j-1])+cnt[1][i][j];
	}
	}
}
	int check1=dp[0][n][n];
	int check2=dp[1][n][n];
	 cout<<min(check1,check2)<<endl;
	 if(check1>check2)
	 {
	 	step(n,n,1);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[1][i];
		}
	 }
	 else
	 {
	 	step(n,n,0);
	 	for(int i=num-1;i>=0;i--)
	 	{
	 		cout<<prev[0][i];
		 }
	}
	 return 0;
}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }

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

            if(d<=min)
            {
                min=d;
            }

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

            if(d==min)
            {
                count++;
            }

        }
        if(min==abs(a[n-1]-a[0]) && n>2)
        {
            count++;
        }
        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }

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

            if(d<=min)
            {

                min=d;
            }

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

            if(d==min)
            {

                count++;
            }

        }

        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        min=10000000000;
        count=1;
        for(i=0;i<n-1;i++)
        {
            d=a[i+1]-a[i];

            if(d<=min)
            {
                if(d==min)
                {
                    count++;
                }
                min=d;
            }

        }

        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }

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

            if(d<=min)
            {
                if(d==min)
                {
                    count++;
                }
                min=d;
            }

        }

        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }

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

            if(d<=min)
            {
                min=d;
            }

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

            if(d==min)
            {
                count++;
            }

        }
        if(min==abs(a[n-1]-a[0]))
        {
            count++;
        }
        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        min=10000000000;
        count=0;
        for(i=0;i<n-1;i++)
        {
            d=a[i+1]-a[i];

            if(d<min)
            {
                min=d;
            }

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

            if(d==min)
            {
                count++;
            }

        }
        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[200000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        min=10000000000;
        count=0;
        for(i=0;i<n-1;i++)
        {
            d=a[i+1]-a[i];

            if(d<min)
            {
                min=d;
            }

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

            if(d==min)
            {
                count++;
            }

        }
        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }

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

            if(d<=min)
            {
                if(d==min)
                {
                    count++;
                }
                min=d;
            }

        }
        if(min==abs(a[n-1]-a[0]))
        {
            count++;
        }
        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    long long int t,i,j,min,count,d,n,a[100000];
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }

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

            if(d<=min)
            {
                if(d==min)
                {
                    count++;
                }
                min=d;
            }

        }

        cout<<min<<" "<<count<<endl;

    return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];

int mn=1e9;
for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
        mn=min(mn,abs(a[j]-a[i]));

        int co=0;
        for(int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
                if(mn==(abs(a[j]-a[i])))
                 co++;

    cout<< mn<<" "<<co<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];

int mn=1e9;
for(int i=0;i<n-1;i++)
    for(int j=i+1;j<n;j++)
        mn=min(mn,abs(a[j]-a[i]));

        int co=0;
        for(int i=0;i<n-1;i++)
            for(int j=i+1;j<n;j++)
                if(mn==(abs(a[j]-a[i])))
                 co++;

    cout<< mn<<" "<<co<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n;
cin>>n;
long long a[n];
for(int i=0;i<n;i++)
cin>>a[i];

long long mn=2*1e9;
for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
        mn=min(mn,abs(a[j]-a[i]));

        long long co=0;
        for(int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
                if(mn==(abs(a[j]-a[i])))
                 co++;

    cout<< mn<<" "<<co<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
long long int n;
cin>>n;
long long a[n];
for(int i=0;i<n;i++)
cin>>a[i];
map<long long,int>m;
long long mn=2*1e9;
for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
        m[abs(a[j]-a[i])]++;
map<long long,int>::iterator it;
it=m.begin();

//        for(int i=0;i<n;i++)
//            for(int j=i+1;j<n;j++)
//                if(mn==(abs(a[j]-a[i])))
//                 co++;

    //cout<< mn<<" "<<co<<endl;

cout<<it->first<<" "<< it->second <<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n;
cin>>n;
long long a[n];
for(int i=0;i<n;i++)
cin>>a[i];
map<long long,int>m;
long long mn=2*1e9;
for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
        m[abs(a[j]-a[i])]++;
map<long long,int>::iterator it;
it=m.begin();

//        for(int i=0;i<n;i++)
//            for(int j=i+1;j<n;j++)
//                if(mn==(abs(a[j]-a[i])))
//                 co++;

    //cout<< mn<<" "<<co<<endl;

cout<<it->first<<" "<< it->second <<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
long long int n;
cin>>n;
long long a[n];
set<long long>b;
for(int i=0;i<n;i++)
cin>>a[i];
map<long long,int>m;
long long mn=2*1e9;
//mn=a[0];
long long co=0;
sort(a,a+n);
long long prev=a[1];
for(int i=1;i<n;i++)
{
   m[(a[i]-a[i-1])]++;

}

map<long long,int>::iterator it;
it=m.begin();

//        for(int i=0;i<n;i++)
//            for(int j=i+1;j<n;j++)
//                if(mn==(abs(a[j]-a[i])))
//                 co++;

    //cout<< mn<<" "<<co<<endl;

cout<<it->first<<" " << it->second <<endl;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    ll n,dist=1e18,ans=0;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        for(int j=0;j<i;j++){
            dist=min(dist,abs(a[i]-a[j]));
        }
    }
    //for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        //for(int j=i+1;j<n;j++){
            //dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        //}
    //}
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    cout<<dist<<" "<<ans;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    int n,dist=1e9,ans=0;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        for(int j=i+1;j<n;j++){
            dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    cout<<dist<<" "<<ans;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    ll n,dist=1e18,ans=0;
    scanf("%lld",&n);
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
        for(int j=0;j<i;j++){
            dist=min(dist,abs(a[i]-a[j]));
        }
    }
    //for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        //for(int j=i+1;j<n;j++){
            //dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        //}
    //}
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    printf("%lld %lld",dist,ans);
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    ll n,dist=1e18,ans=0;
    scanf("%lld",&n);
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    sort(a.begin(),a.end());
    for(int i=1;i<n;i++){
        dist=min(dist,abs(a[i]-a[i-1]));
    }
    //for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        //for(int j=i+1;j<n;j++){
            //dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        //}
    //}
    for(int i=1;i<n;i++){
        if(abs(a[i]-a[i-1])==dist)ans++;
    }
    printf("%lld %lld",dist,ans);
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    ll n,dist=1e18,ans=0;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        for(int j=i+1;j<n;j++){
            dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    cout<<dist<<" "<<ans;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    ll n,dist=1e9,ans=0;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        for(int j=i+1;j<n;j++){
            dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    cout<<dist<<" "<<ans;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    int n,dist=1e9,ans=0;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        for(int j=i+1;j<n;j++){
            dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    cout<<dist<<" "<<ans;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;
#define PI 3.14159265358979
int main(){
    ll n,dist=1e18,ans=0;
    scanf("%lld",&n);
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    sort(a.begin(),a.end());
    for(int i=1;i<n;i++){
        dist=min(dist,abs(a[i]-a[i-1]));
    }
    //for(int i=0;i<n;i++){
        //cout<<a[i]<<endl;
        //for(int j=i+1;j<n;j++){
            //dist=min(dist,abs(a[i]-a[j]));
            //cout<<abs(a[i]-a[j])<<endl;
        //}
    //}
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])==dist)ans++;
        }
    }
    printf("%lld %lld",dist,ans);
    return 0;
}


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

const int N = 2e5 + 10;
int n;
int a[N];
struct xx
{
    int a, b, len;
}f[N];

int cmp(xx a, xx b)
{
    return a.len < b.len;
}

int main()
{
    while(scanf("%d", &n) == 1)
    {
        for(int i = 1; i <= n; i++)
        {
            scanf("%d", &a[i]);
        }
        int x = 0;
        for(int i = 1; i <= n; i++)
        {
            for(int j = i + 1; j <= n; j++)
            {
                f[x].a = i, f[x].b = j, f[x].len = abs(a[i] - a[j]);
                x++;
            }
        }
        sort(f, f + x, cmp);
        printf("%d ", f[0].len);
        int sum = 1;
        for(int i = 1; i < x; i++)
        {
            if(f[i].len == f[0].len)
                sum++;
        }
        printf("%d\n", sum);
    }
}


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

const int N = 2e6 + 10;
int n;
int a[N];
struct xx
{
    int a, b, len;
}f[N];

int cmp(xx a, xx b)
{
    return a.len < b.len;
}

int main()
{
    while(scanf("%d", &n) == 1)
    {
        memset(a, 0, sizeof(a));
        memset(f, 0, sizeof(f));
        for(int i = 1; i <= n; i++)
        {
            scanf("%d", &a[i]);
        }
        int x = 0;
        for(int i = 1; i <= n; i++)
        {
            for(int j = i + 1; j <= n; j++)
            {
                f[x].a = i, f[x].b = j, f[x].len = abs(a[i] - a[j]);
                x++;
            }
        }
        sort(f, f + x, cmp);
        printf("%d ", f[0].len);
        int sum = 1;
        for(int i = 1; i < x; i++)
        {
            if(f[i].len == f[0].len)
                sum++;
        }
        printf("%d\n", sum);
    }
}


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

const int N = 2e5 + 10;
int n;
int a[N];

int main()
{
    while(scanf("%d", &n) == 1)
    {
        int minx = 0x7fffffff, sum = 1;
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &a[i]);
        }
        sort(a,a+n);
        for(int i = 1; i < n; i++)
        {
            if(a[i]-a[i-1] < minx)
            {
                sum = 1;
                minx = a[i] - a[i-1];
            }
            else if(a[i]-a[i-1] == minx) sum++;
        }
        printf("%d %d\n", minx, sum);
    }
}


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

const int N = 2e6 + 10;
int n;
int a[N];
struct xx
{
    int a, b, len;
}f[N];

int cmp(xx a, xx b)
{
    return a.len < b.len;
}

int main()
{
    while(scanf("%d", &n) == 1)
    {
        for(int i = 1; i <= n; i++)
        {
            scanf("%d", &a[i]);
        }
        int x = 0;
        for(int i = 1; i <= n; i++)
        {
            for(int j = i + 1; j <= n; j++)
            {
                f[x].a = i, f[x].b = j, f[x].len = abs(a[i] - a[j]);
                x++;
            }
        }
        sort(f, f + x, cmp);
        printf("%d ", f[0].len);
        int sum = 1;
        for(int i = 1; i < x; i++)
        {
            if(f[i].len == f[0].len)
                sum++;
        }
        printf("%d\n", sum);
    }
}


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

const int N = 2e5 + 10;
int n;
int a[N];

int main()
{
    while(scanf("%d", &n) == 1)
    {
        int minx = 0x7fffffff, sum = 1;
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &a[i]);
        }
        for(int i = 0; i < n; i++)
        {
            for(int j = i+1; j < n; j++)
            {
                int tmp = abs(a[i]-a[j]);
                if(tmp == minx) sum++;
                else if(tmp <minx)
                {
                    sum = 1;
                    minx = tmp;
                }
            }
        }
        printf("%d %d\n", minx, sum);
    }
}


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

const int N = 2e5 + 10;
int n;
int a[N];

int main()
{
    while(scanf("%d", &n) == 1)
    {
        int minx = 0x3f3f3f, sum = 0;
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &a[i]);
        }
        for(int i = 0; i < n; i++)
        {
            for(int j = i+1; j < n; j++)
            {
                int tmp = abs(a[i]-a[j]);
                if(tmp == minx) sum++;
                else if(tmp <minx)
                {
                    sum = 1;
                    minx = tmp;
                }
            }
        }
        printf("%d %d\n", minx, sum);
    }
}


#include <bits/stdc++.h>
using namespace std;
vector<unsigned int> v;
unsigned int n;
int main ()
{
cin>>n;
long long a[n+1];
for (int i=0; i<n; i++) cin>>a[i];
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) v.push_back(abs(a[i]-a[j]));
sort(v.begin(), v.end());
int f=1;
while(v[f]==v[f-1]) f++;
v.clear();
cout<<v[0]<<" "<<f<<endl;
}


#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
unsigned int n;
int main ()
{
cin>>n;
long long a[n+1];
for (int i=0; i<n; i++) cin>>a[i];
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) v.push_back(abs(a[i]-a[j]));
int m=v[0];
int s=0;
for (int i=1; i<v.size(); i++) if (v[i]<m) m=v[i];
for (int i=1; i<v.size(); i++) if (v[i]==m) s++;
cout<<m<<" "<<s<<endl;
}


#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int n;
int main ()
{
cin>>n;
long long a[n+1];
for (int i=0; i<n; i++) cin>>a[i];
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) v.push_back(abs(a[i]-a[j]));
sort(v.begin(), v.end());
int f=1;
while(v[f]==v[f-1]) f++;
cout<<v[0]<<" "<<f<<endl;
}


#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i=0; i<n; i++) scanf("%d", &a[i]);
    sort(a, a+n);
    long long min_dist=100000000007;
    int numb=0;
    for (int i=1; i<n; i++)
    {
        long long d=abs(a[i]-a[i-1]);
        if (d<min_dist) {min_dist=d;
        numb=1;}
        else if (d==min_dist) numb++;
    }
    printf("%lld %d\n", min_dist, numb);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<unsigned int> v;
unsigned int n;
int main ()
{
cin>>n;
long long a[n+1];
for (int i=0; i<n; i++) cin>>a[i];
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) v.push_back(abs(a[i]-a[j]));
sort(v.begin(), v.end());
int f=1;
while(v[f]==v[f-1]) f++;
cout<<v[0]<<" "<<f<<endl;
}


#include <bits/stdc++.h>
using namespace std;
unsigned int n;
int main ()
{
cin>>n;
long long k;
vector<unsigned int> v;
vector<long long> a;
for (int i=0; i<n; i++) {cin>>k;
a.push_back(k);}
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) v.push_back(abs(a[i]-a[j]));
a.clear();
sort(v.begin(), v.end());
int f=1;
while(v[f]==v[f-1]) f++;
v.clear();
cout<<v[0]<<" "<<f<<endl;
}


#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    long long a[n];
    for (int i=0; i<n; i++) scanf("%d", &a[i]);
    sort(a, a+n);
    long long min_dist=100000000007;
    int numb=0;
    for (int i=1; i<n; i++)
    {
        long long d=abs(a[i]-a[i-1]);
        if (d<min_dist) {min_dist=d;
        numb=1;}
        else if (d==min_dist) numb++;
    }
    printf("%lld %d\n", min_dist, numb);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int n;
long long a[200007];
int main ()
{
cin>>n;
for (int i=0; i<n; i++) cin>>a[i];
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) v.push_back(abs(a[i]-a[j]));
sort(v.begin(), v.end());
int f=1;
while(v[f]==v[f-1]) f++;
cout<<v[0]<<" "<<f<<endl;
}


#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    long long a[n+7];
    for (int i=0; i<n; i++) scanf("%d", &a[i]);
    sort(a, a+n);
    long long min_dist=100000000007;
    int numb=0;
    for (int i=1; i<n; i++)
    {
        long long d=abs(a[i]-a[i-1]);
        if (d<min_dist) {min_dist=d;
        numb=1;}
        else if (d==min_dist) numb++;
    }
    printf("%lld %d\n", min_dist, numb);
    return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopj(j,n){
		cin>>arr[j];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	for(int i=1;i<n;i++){
		if(arr[i]-arr[i-1]<mn)
        {
            mn=arr[i]-arr[i-1] ;
           res=1 ;
        }

        else if(arr[i]-arr[i-1]==mn)
        {
            res++ ;
        }
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	loopi(i,n){

		if(mn==abs(arr[i]-arr[i+1])){ res++;}
		else if(abs(arr[i]-arr[i+1])<mn){mn=abs(arr[i]-arr[i+1]);res=1;}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	SCLL(n);
	ll arr[100005];
	loopj(j,n){
		SCLL(arr[j]);
	}
	sort(arr,arr+n);
	ll mn=arr[n - 1] - arr[0];
    ll res=0;
	for(int i=0;i<n-1;i++){
		ll mn1 = arr[i + 1] - arr[i];
		if (mn > mn1)
			mn = mn1, res = 0;
		if (mn == mn1)
			++res;
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	ll mn=55555555;
	loopi(i,n){
		for(int j=i+1;j<n;j++){
			if(i==j){continue;}
			mn=min(mn,abs(arr[i]-arr[j]));
		}
	}
	ll res=0;
	loopi(i,n){
		for(int j=i+1;j<n;j++){
			if(i==j){continue;}
			if(abs(arr[i]-arr[j])==mn)
			{res++;}
		}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
vll arr; ll res=0,n;
int main()
{

   afify();
	SCLL(n);
	arr.resize(n);
	loopj(j,n){
		SCLL(arr[j]);
	}
	sort(all(arr));
	ll mn=arr[n - 1] - arr[0];
	for(int i=0;i<n-1;i++){
		ll mn1 = arr[i + 1] - arr[i];
		if (mn > mn1)
			mn = mn1, res = 0;
		if (mn == mn1)
			++res;
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopj(j,n){
		cin>>arr[j];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	for(int i=1;i<n;i++){
		if(abs(arr[i]-arr[i-1])<mn)
        {
            mn=abs(arr[i]-arr[i-1]) ;
           res=1 ;
        }

        else if(abs(arr[i]-arr[i-1])==mn)
        {
            res++ ;
        }
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[1000005]; ll res=0,n;
int main()
{

   afify();
	SCLL(n);
	loopj(j,n){
		SCLL(arr[j]);
	}
	sort(arr,arr+n);
	ll mn=arr[n - 1] - arr[0];
	for(int i=0;i<n-1;i++){
		ll mn1 = arr[i + 1] - arr[i];
		if (mn > mn1)
			mn = mn1, res = 0;
		if (mn == mn1)
			++res;
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
 ll res=0,n;
int main()
{

   afify();
	SCLL(n);
	vi arr(n);
	loopj(j,n){
		SCLL(arr[j]);
	}
	sort(all(arr));
	ll mn=arr[n - 1] - arr[0];
	for(int i=0;i<n-1;i++){
		ll mn1 = arr[i + 1] - arr[i];
		if (mn > mn1)
			mn = mn1, res = 0;
		if (mn == mn1)
			++res;
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	SCLL(n);
	ll arr[100005];
	loopj(j,n){
		SCLL(arr[j]);
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	for(int i=0;i<n-1;i++){
		ll mn1 = arr[i + 1] - arr[i];
		if (mn > mn1)
			mn = mn1, res = 0;
		if (mn == mn1)
			++res;
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	loopi(i,n){
		if(abs(arr[i]-arr[i+1])<mn)
        {
            mn=abs(arr[i]-arr[i-1]) ;
           res=1 ;
        }

        else if(abs(arr[i]-arr[i+1])==mn)
        {
            res++ ;
        }
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	loopi(i,n){

		if(mn==abs(arr[i]-arr[i+1])){ res++;}
		else if(abs(arr[i]-arr[i+1])<mn){mn=abs(arr[i]-arr[i+1]);res=1;}
	}

	cout<<mn<<"  "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopj(j,n){
		cin>>arr[j];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	for(int i=n-1;i>=0;i--){
		if(abs(arr[i]-arr[i-1])<mn)
        {
            mn=abs(arr[i]-arr[i-1]) ;
           res=1 ;
        }

        else if(abs(arr[i]-arr[i-1])==mn)
        {
            res++ ;
        }
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555,cmp=555555555555555555;
    ll res=0;
	loopi(i,n){
		if(abs(arr[i]-arr[i+1])<mn){mn=abs(arr[i]-arr[i+1]);res=1;}
		else if(mn==abs(arr[i]-arr[i+1])){ res++;}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	ll mn=555555555555555555;
	loopi(i,n){
		for(int j=i+1;j<n;j++){
			if(i==j){continue;}
			mn=min(mn,abs(arr[i]-arr[j]));
		}
	}
	ll res=0;
	loopi(i,n){
		for(int j=i+1;j<n;j++){
			if(i==j){continue;}
			if(abs(arr[i]-arr[j])==mn)
			{res++;}
		}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	SCLL(n);
	ll arr[100005];
	loopj(j,n){
		SCLL(arr[j]);
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	for(int i=1;i<n;i++){
		if(arr[i]-arr[i-1]<mn)
        {
            mn=arr[i]-arr[i-1] ;
           res=1 ;
        }

        else if(arr[i]-arr[i-1]==mn)
        {
            res++ ;
        }
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	loopi(i,n){
		ll mn1=abs(arr[i]-arr[i+1]);
		if(mn==mn1){ res++;}
		else if(mn1<mn){mn=mn1;res=1;}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555,cmp=555555555555555555;
    ll res=0;
	loopi(i,n){
		if(abs(arr[i]-arr[i+1])<mn){mn=abs(arr[i]-arr[i+1]);res=1;}
		else if(mn==abs(arr[i]-arr[i+1])){ res++;}
	}

	cout<<mn<<"  "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=n;i<=0;i--)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopj(j,n){
		cin>>arr[j];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	for(int i=n-1;i>0;i--){
		if(abs(arr[i]-arr[i-1])<mn)
        {
            mn=abs(arr[i]-arr[i-1]) ;
           res=1 ;
        }

        else if(abs(arr[i]-arr[i-1])==mn)
        {
            res++ ;
        }
	}
	cout<<mn<<" "<<res<<endl;
return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{

   afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll mn=555555555555555555;
    ll res=0;
	loopi(i,n){
		ll mn1=abs(arr[i]-arr[i+1]);
		if(mn==mn1){ res++;}
		else if(mn1<mn){mn=mn1;res=1;}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include<bits/stdc++.h>
#include<unordered_set>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,n)  for(int i=0;i<n;i++)
#define loopj(j,n) for(int j=0;j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const int oo = (int) 1e3;
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
ll arr[10000000];
int main()
{

    afify();
	ll n;
	cin>>n;
	ll arr[100005];
	loopi(i,n){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	if(n==3){cout<<2<<" "<<2;return 0;}
	ll mn=555555555555555555;
    ll res=0;
	loopi(i,n){

		if(mn==abs(arr[i]-arr[i+1])){ res++;}
		else if(abs(arr[i]-arr[i+1])<mn){mn=abs(arr[i]-arr[i+1]);res=1;}
	}

	cout<<mn<<" "<<res<<endl;

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n ; cin >> n;
    vector <int> v;
    for(int i =0 ; i <n ; i++){
        int x; cin >> x;
        v.push_back(x);
    }
    sort(v.begin() , v.end());
    int min_distance = abs(v[n-1] - v[0]);
    int c =0;
    for (int i =0 ; i < n -1 ; i ++){
        if (abs(v[i+1] - v[i]) < min_distance){
            min_distance = abs(v[i+1] - v[i]);
            c = 1;
        }
        else if (abs(v[i+1] - v[i]) == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n ; cin >> n;
    vector <int> v;
    for(int i =0 ; i <n ; i++) v.push_back(i);
    sort(v.begin() , v.end());
    int min_distance = abs(v[n-1] - v[0]);
    int c =0;
    for (int i =0 ; i < n -1 ; i ++){
        if (abs(v[i+1] - v[i]) < min_distance){
            min_distance = abs(v[i+1] - v[i]);
            c = 1;
        }
        else if (abs(v[i+1] - v[i]) == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
void quick_sort(register long long int *arr , int start , int finish){
    int mark_index = finish;
    for(int i = start ; i < mark_index ; i++){
        if (arr[i] >= arr[mark_index]){
            mark_index --;
            swap(arr[mark_index] , arr[mark_index+1]);
            if (mark_index != i) swap(arr[i] , arr[mark_index +1]);
            i--;
        }
    }
    if (mark_index != start) quick_sort(arr , start , mark_index-1);
    if (mark_index != finish) quick_sort(arr , mark_index+1 , finish);
}
int main(){
    int n ; cin >> n;
    register long long int * arr = new long long int[n];
    for(int i =0 ; i< n ; i++) cin >> arr[i];
    quick_sort(arr , 0 , n-1);
    register long long int min_distance = arr[n-1] - arr[0];
    int c =0;
    for (register int i =0 ; i < n -1 ; i ++){
        if (abs(arr[i+1] - arr[i]) < min_distance){
            min_distance = abs(arr[i+1] - arr[i]);
            c = 1;
        }
        else if (abs(arr[i+1] - arr[i]) == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
void quick_sort(long long int *arr , int start , int finish){
    int mark_index = finish;
    for(int i = start ; i < mark_index ; i++){
        if (arr[i] >= arr[mark_index]){
            mark_index --;
            swap(arr[mark_index] , arr[mark_index+1]);
            if (mark_index != i) swap(arr[i] , arr[mark_index +1]);
            i--;
        }
    }
    if (mark_index != start) quick_sort(arr , start , mark_index-1);
    if (mark_index != finish) quick_sort(arr , mark_index+1 , finish);
}
int main(){
    int n ; cin >> n;
    long long int * arr = new long long int[n];
    for(int i =0 ; i< n ; i++) cin >> arr[i];
    quick_sort(arr , 0 , n-1);
    long long int min_distance = arr[n-1] - arr[0];
    int c =0;
    for (int i =0 ; i < n -1 ; i ++){
        if (abs(arr[i+1] - arr[i]) < min_distance){
            min_distance = abs(arr[i+1] - arr[i]);
            c = 1;
        }
        else if (abs(arr[i+1] - arr[i]) == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <iostream>
#include <conio.h>
using namespace std;
void quick_sort(int *arr , int start , int finish){
    int mark_index = finish;
    for(int i = start ; i < mark_index ; i++){
        if (arr[i] >= arr[mark_index]){
            mark_index --;
            swap(arr[mark_index] , arr[mark_index+1]);
            if (mark_index != start) swap(arr[i] , arr[mark_index +1]);
            i--;
        }
    }
    if (mark_index != start) quick_sort(arr , start , mark_index-1);
    if (mark_index != finish) quick_sort(arr , mark_index+1 , finish);
}
int main(){
    int n ; cin >> n;
    int * arr = new int[n];
    for(int i =0 ; i< n ; i++) cin >> arr[i];
    quick_sort(arr , 0 , n-1);
    int min_distance = arr[n-1] - arr[0];
    int c =0;
    for (int i =0 ; i < n -1 ; i ++){
        if (arr[i+1] - arr[i] < min_distance){
            min_distance = arr[i+1] - arr[i];
            c = 1;
        }
        else if (arr[i+1] - arr[i] == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
void quick_sort(int *arr , int start , int finish){
    int mark_index = finish;
    for(int i = start ; i < mark_index ; i++){
        if (arr[i] >= arr[mark_index]){
            mark_index --;
            swap(arr[mark_index] , arr[mark_index+1]);
            if (mark_index != start) swap(arr[i] , arr[mark_index +1]);
            i--;
        }
    }
    if (mark_index != start) quick_sort(arr , start , mark_index-1);
    if (mark_index != finish) quick_sort(arr , mark_index+1 , finish);
}
int main(){
    int n ; cin >> n;
    int * arr = new int[n];
    for(int i =0 ; i< n ; i++) cin >> arr[i];
    quick_sort(arr , 0 , n-1);
    int min_distance = arr[n-1] - arr[0];
    int c =0;
    for (int i =0 ; i < n -1 ; i ++){
        if (abs(arr[i+1] - arr[i]) < min_distance){
            min_distance = abs(arr[i+1] - arr[i]);
            c = 1;
        }
        else if (abs(arr[i+1] - arr[i]) == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
void quick_sort(int *arr , int start , int finish){
    int mark_index = finish;
    for(int i = start ; i < mark_index ; i++){
        if (arr[i] >= arr[mark_index]){
            mark_index --;
            swap(arr[mark_index] , arr[mark_index+1]);
            if (mark_index != i) swap(arr[i] , arr[mark_index +1]);
            i--;
        }
    }
    if (mark_index != start) quick_sort(arr , start , mark_index-1);
    if (mark_index != finish) quick_sort(arr , mark_index+1 , finish);
}
int main(){
    int n ; cin >> n;
    int * arr = new int[n];
    bool sorted = true;
    for(int i =0 ; i< n ; i++){
        cin >> arr[i];
        if (i && arr[i] < arr[i-1]) sorted = false;
    }
    if (!sorted) quick_sort(arr , 0 , n-1);
    int min_distance = abs(arr[n-1] - arr[0]);
    int c =0;
    for (int i =0 ; i < n -1 ; i ++){
        if (abs(arr[i+1] - arr[i]) < min_distance){
            min_distance = abs(arr[i+1] - arr[i]);
            c = 1;
        }
        else if (abs(arr[i+1] - arr[i]) == min_distance) c++;
    }
    cout << min_distance <<" " << c;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector < long long int > v(n);

	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	sort( v.begin(), v.end() );

	long long int menor = 1000000000;
	int cant = 0;

	for( int i = 0; i < n-1; i++ ) {
		if( abs(v[i+1]-v[i]) < menor ) {
			menor = v[i+1]-v[i];
			cant = 1;
		}
		else if( abs(v[i+1]-v[i]) == menor ) {
			cant++;
		}
	}

	cout << menor << " " << 	cant << endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector < long long > v(n);

	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	sort( v.begin(), v.end() );

	long long int menor = 1000000;
	int cant = 0;

	for( int i = 0; i < n-1; i++ ) {
		if( v[i+1]-v[i] < menor ) {
			menor = v[i+1]-v[i];
			cant = 1;
		}
		else if( v[i+1]-v[i] == menor ) {
			cant++;
		}
	}

	printf("%lld %d\n", menor, cant);

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector < long long int > v(n);

	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	sort( v.begin(), v.end() );

	long long int menor = abs(v[0] - v[1]);
	int cant = 1;

	for( int i = 1; i < n-1; i++ ) {
		if( abs(v[i+1]-v[i]) < menor ) {
			menor = v[i+1]-v[i];
			cant = 1;
		}
		else if( abs(v[i+1]-v[i]) == menor ) {
			cant++;
		}
	}

	cout << menor << " " << cant << endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector < long long int > v(n);

	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	sort( v.begin(), v.end() );

	long long int menor = 1000000;
	int cant = 0;

	for( int i = 0; i < n-1; i++ ) {
		if( abs(v[i+1]-v[i]) < menor ) {
			menor = v[i+1]-v[i];
			cant = 1;
		}
		else if( abs(v[i+1]-v[i]) == menor ) {
			cant++;
		}
	}

	cout << menor << cant << endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector < long long > v(n);

	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	sort( v.begin(), v.end() );

	long long int menor = 1000000;
	int cant = 0;

	for( int i = 0; i < n-1; i++ ) {
		if( abs(v[i+1]-v[i]) < menor ) {
			menor = v[i+1]-v[i];
			cant = 1;
		}
		else if( abs(v[i+1]-v[i]) == menor ) {
			cant++;
		}
	}

	printf("%lld %d\n", menor, cant);

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector < long long > v(n);

	for( int i = 0; i < n; i++ ) {
		cin >> v[i];
	}

	sort( v.begin(), v.end() );

	long long int menor = 1000000;
	int cant = 0;

	for( int i = 0; i < n-1; i++ ) {
		if( abs(v[i+1]-v[i]) < menor ) {
			menor = v[i+1]-v[i];
			cant = 1;
		}
		else if( v[i+1]-v[i] == menor ) {
			cant++;
		}
	}

	printf("%lld %d\n", menor, cant);

	return 0;
}


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

#define ABS(x) ((x)<0 ? -(x) : (x))
#define REP(i,n) for(int i=0, _e(n); i<_e; i++)
#define SET(t,v) memset((t), (v), sizeof(t))
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize( unique( ALL(c) ) - (c).begin() )

#define inf_int (1<<31)-1
#define inf_long (1<<63)-1
#define sz size()
#define pb push_back
#define VI vector<int>
#define VS vector<string>

typedef long double LD;
typedef pair<int,int> pii;

#ifdef DEBUG
#define dbg(x) x
#define dbgp(x) cerr << x ;
#else
#define dbg(x) //x
#define dbgp(x) //cerr << x << endl;
#endif

int n ;
int a[2*100001];

int main(){
    cin >> n ;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    sort(a,a+n+1);
    map<long long,long long> m ;
    for(int i=1;i<=n;i++){
        m[ABS(a[i]-a[i-1])]++;
    }
    map<long long,long long>::iterator it = m.begin() ;
    for(pair<long long,long long> p : m ){
        cout << p.first << " " << p.second << endl;
    }
    if ( m.size() >= 2 ) ++it;
    cout << it->first << " " << it->second << endl;
    return 0;
}


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

#define ABS(x) ((x)<0 ? -(x) : (x))
#define REP(i,n) for(int i=0, _e(n); i<_e; i++)
#define SET(t,v) memset((t), (v), sizeof(t))
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize( unique( ALL(c) ) - (c).begin() )

#define inf_int (1<<31)-1
#define inf_long (1<<63)-1
#define sz size()
#define pb push_back
#define VI vector<int>
#define VS vector<string>

typedef long double LD;
typedef pair<int,int> pii;

#ifdef DEBUG
#define dbg(x) x
#define dbgp(x) cerr << x ;
#else
#define dbg(x) //x
#define dbgp(x) //cerr << x << endl;
#endif

int n ;
int a[2*100001];

int main(){
    cin >> n ;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    sort(a,a+n+1);
    map<long long,long long> m ;
    for(int i=1;i<=n;i++){
        m[ABS(a[i]-a[i-1])]++;
    }
    map<long long,long long>::iterator it = m.begin() ;
    ++it;
    cout << it->first << " " << it->second << endl;
    return 0;
}


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

#define ABS(x) ((x)<0 ? -(x) : (x))
#define REP(i,n) for(int i=0, _e(n); i<_e; i++)
#define SET(t,v) memset((t), (v), sizeof(t))
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize( unique( ALL(c) ) - (c).begin() )

#define inf_int (1<<31)-1
#define inf_long (1<<63)-1
#define sz size()
#define pb push_back
#define VI vector<int>
#define VS vector<string>

typedef long double LD;
typedef pair<int,int> pii;

#ifdef DEBUG
#define dbg(x) x
#define dbgp(x) cerr << x ;
#else
#define dbg(x) //x
#define dbgp(x) //cerr << x << endl;
#endif

int n ;
int a[2*100001];

int main(){
    cin >> n ;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    sort(a,a+n+1);
    map<long long,long long> m ;
    for(int i=1;i<=n;i++){
        m[ABS(a[i]-a[i-1])]++;
    }
    map<long long,long long>::iterator it = m.begin() ;
    if ( m.size() >= 2 ) ++it;
    cout << it->first << " " << it->second << endl;
    return 0;
}


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

#define ABS(x) ((x)<0 ? -(x) : (x))
#define REP(i,n) for(int i=0, _e(n); i<_e; i++)
#define SET(t,v) memset((t), (v), sizeof(t))
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize( unique( ALL(c) ) - (c).begin() )

#define inf_int (1<<31)-1
#define inf_long (1<<63)-1
#define sz size()
#define pb push_back
#define VI vector<int>
#define VS vector<string>

typedef long double LD;
typedef pair<int,int> pii;

#ifdef DEBUG
#define dbg(x) x
#define dbgp(x) cerr << x ;
#else
#define dbg(x) //x
#define dbgp(x) //cerr << x << endl;
#endif

int n ;
int a[2*100001];

int main(){
    cin >> n ;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    map<long long,long long> m ;
    for(int i=1;i<n;i++){
        m[ABS(a[i]-a[i-1])]++;
    }
    map<long long,long long>::iterator it = m.begin() ;
    cout << it->first << " " << it->second << endl;
    return 0;
}


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

#define ABS(x) ((x)<0 ? -(x) : (x))
#define REP(i,n) for(int i=0, _e(n); i<_e; i++)
#define SET(t,v) memset((t), (v), sizeof(t))
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize( unique( ALL(c) ) - (c).begin() )

#define inf_int (1<<31)-1
#define inf_long (1<<63)-1
#define sz size()
#define pb push_back
#define VI vector<int>
#define VS vector<string>

typedef long double LD;
typedef pair<int,int> pii;

#ifdef DEBUG
#define dbg(x) x
#define dbgp(x) cerr << x ;
#else
#define dbg(x) //x
#define dbgp(x) //cerr << x << endl;
#endif

int n ;
int a[2*100001];

int main(){
    cin >> n ;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    map<long long,long long> m ;
    for(int i=1;i<n;i++){
        m[ABS(a[i]-a[i-1])]++;
    }
    map<long long,long long>::iterator it = m.begin() ;
    if ( m.size() >= 2 ) ++it;
    cout << it->first << " " << it->second << endl;
    return 0;
}