There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a_1, a_2, ..., a_{n}. All coordinates are pairwise distinct.

It is possible to get from one city to another only by bus. But all buses and roads are very old, so the Minister of Transport decided to build a new bus route. The Minister doesn't want to spend large amounts of money — he wants to choose two cities in such a way that the distance between them is minimal possible. The distance between two cities is equal to the absolute value of the difference between their coordinates.

It is possible that there are multiple pairs of cities with minimal possible distance, so the Minister wants to know the quantity of such pairs. 

Your task is to write a program that will calculate the minimal possible distance between two pairs of cities and the quantity of pairs which have this distance.


-----Input-----

The first line contains one integer number n (2 ≤ n ≤ 2·10^5).

The second line contains n integer numbers a_1, a_2, ..., a_{n} ( - 10^9 ≤ a_{i} ≤ 10^9). All numbers a_{i} are pairwise distinct.


-----Output-----

Print two integer numbers — the minimal distance and the quantity of pairs with this distance.


-----Examples-----
Input
4
6 -3 0 4

Output
2 1

Input
3
-2 0 2

Output
2 2



-----Note-----

In the first example the distance between the first city and the fourth city is |4 - 6| = 2, and it is the only pair with this distance.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation


Solutions:
count = 1
min_d = 100000000000000000
n = int(input())
data = list(map(int, input().split()))
data.sort()
prev = data[0]
for el in data:
	if prev == el:
		continue
	if el - prev < min_d:
		min_d = el - prev
		count = 1
	elif el - prev == min_d:
		count += 1
	prev = el
print(min_d, count)


n = int(input())
a = sorted((int(x) for x in input().split()))
md = 9999999999
cnt = 0
for (x, y) in zip(a, a[1:]):
	if y - x < md:
		cnt = 1
		md = y - x
	elif y - x == md:
		cnt += 1
print(md, cnt)


n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
minn = float('inf')
for i in range(len(l) - 1):
	if minn == abs(l[i + 1] - l[i]):
		cnt += 1
	elif minn > abs(l[i + 1] - l[i]):
		cnt = 1
		minn = abs(l[i + 1] - l[i])
print(minn, cnt)


class CodeforcesTask792ASolution:

	def __init__(self):
		self.result = ''
		self.cities = 0
		self.cords = []

	def read_input(self):
		self.cities = int(input())
		self.cords = [int(x) for x in input().split(' ')]

	def process_task(self):
		self.cords.sort()
		dists = [self.cords[x + 1] - self.cords[x] for x in range(self.cities - 1)]
		smallest_dist = min(dists)
		sm_dist_quant = dists.count(smallest_dist)
		self.result = '{0} {1}'.format(smallest_dist, sm_dist_quant)

	def get_result(self):
		return self.result
Solution = CodeforcesTask792ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


import math
a = []
resl = []
resm = 10000000000000000
resk = 1
n = int(input())
s = input().split()
a = [int(c) for c in s]
a.sort()
for i in range(len(a) - 1):
	resl.append(int(math.fabs(a[i] - a[i + 1])))
print(str(min(resl)) + ' ' + str(resl.count(min(resl))))


def merge(a, b):
	i = 0
	j = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] <= b[j]:
			ans += [a[i]]
			i += 1
		else:
			ans += [b[j]]
			j += 1
	if i < len(a):
		for k in range(i, len(a)):
			ans += [a[k]]
	if j < len(b):
		for k in range(j, len(b)):
			ans += [b[k]]
	return ans

def sort(list_a):
	if len(list_a) == 1 or len(list_a) == 0:
		return list_a
	else:
		return merge(sort(list_a[0:len(list_a) // 2]), sort(list_a[len(list_a) // 2:len(list_a)]))
(n, a) = (int(input()), sorted(map(int, input().split())))
m = 20000000000
for i in range(0, len(a) - 1):
	if a[i + 1] - a[i] < m:
		m = a[i + 1] - a[i]
		count = 1
	elif m == a[i + 1] - a[i]:
		count += 1
print(str(m) + ' ' + str(count))


n = int(input())
a = sorted(map(int, input().split()))
md = a[1] - a[0]
mc = 1
for i in range(2, len(a)):
	cd = a[i] - a[i - 1]
	if cd == md:
		mc += 1
	elif cd < md:
		md = cd
		mc = 1
print('{0} {1}'.format(md, mc))


n = int(input())
l = list(map(int, input().split()))
l.sort()
(mn, cnt) = (int(10000000000.0), 0)
for i in range(1, n):
	if l[i] - l[i - 1] < mn:
		mn = l[i] - l[i - 1]
		cnt = 1
	elif l[i] - l[i - 1] == mn:
		cnt += 1
print(mn, cnt)


n = int(input())
m = sorted(map(int, input().split()))
d = [m[i] - m[i - 1] for i in range(1, n)]
a = min(d)
print(a, d.count(a))


def main():
	input()
	a = map(int, input().split())
	a = sorted(a)
	d = [a[i + 1] - a[i] for i in range(len(a) - 1)]
	m = int(2 * 1000000000.0 + 1)
	c = 0
	for x in d:
		if x < m:
			m = x
			c = 1
		elif x == m:
			c += 1
	print(m, c)
main()


n = int(input())
(*ar,) = map(int, input().split())
ar.sort()
temp = []
for i in range(n - 1):
	temp.append(ar[i + 1] - ar[i])
print(min(temp), temp.count(min(temp)))


n = int(input())
a = list(map(int, input().split()))
a.sort()
minm = 10000000000
mincount = 0
for i in range(n - 1):
	if a[i + 1] - a[i] == minm:
		mincount += 1
	elif a[i + 1] - a[i] < minm:
		minm = a[i + 1] - a[i]
		mincount = 1
print(minm, mincount)


n = int(input())
a = list(map(int, input().split()))
a.sort()
x = 2000000009
for i in range(n - 1):
	x = min(x, a[i + 1] - a[i])
ans = 0
for i in range(n - 1):
	if a[i + 1] - a[i] == x:
		ans += 1
print(x, ans)


n = int(input().strip())
ais = list(map(int, input().strip().split()))
ais.sort()
bis = [ais[i] - ais[i - 1] for i in range(1, n)]
m = min(bis)
v = bis.count(m)
print(m, v)


from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans
n = ii()
l = sorted(li())
min = sys.maxsize
for i in range(n - 1):
	if abs(l[i + 1] - l[i]) < min:
		min = abs(l[i + 1] - l[i])
count = 0
for i in range(n - 1):
	if abs(l[i + 1] - l[i]) == min:
		count += 1
print(min, count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
lis1 = [a[i] - a[i - 1] for i in range(1, n)]
print(min(lis1), lis1.count(min(lis1)))


import heapq
n = int(input().rstrip())
array = [int(a) for a in input().split()]
heapq.heapify(array)
minDiff = 2000000000.0
count = 0
a1 = heapq.heappop(array)
while array:
	a2 = heapq.heappop(array)
	if abs(a2 - a1) < minDiff:
		minDiff = a2 - a1
		count = 1
	elif abs(a2 - a1) == minDiff:
		count += 1
	a1 = a2
print(int(minDiff), int(count))


n = int(input())
l = list(map(int, input().split()))
l.sort()
m = abs(l[0] - l[1])
for i in range(1, n - 1):
	a = abs(l[i] - l[i + 1])
	m = min(a, m)
c = 0
for i in range(n - 1):
	if abs(l[i] - l[i + 1]) == m:
		c += 1
print(m, c)


n = int(input())
a = sorted(map(int, input().split()))
di = [a[i] - a[i - 1] for i in range(1, n)]
mi = min(di)
print(mi, di.count(mi))


n = int(input())
l = input().split()
li = [int(i) for i in l]
li.sort()
maxa = 10 ** 10
for i in range(1, n):
	maxa = min(maxa, li[i] - li[i - 1])
count = 0
for i in range(1, n):
	if li[i] - li[i - 1] == maxa:
		count += 1
print(maxa, count)


import heapq
N = int(input())
As = map(int, input().split())
ds = []
dic = {}
As = list(sorted(As))
for i in range(N - 1):
	d = As[i + 1] - As[i]
	heapq.heappush(ds, d)
	if d in dic:
		dic[d] += 1
	else:
		dic[d] = 1
d = heapq.heappop(ds)
print(' '.join(map(str, (d, dic[d]))))


n = int(input())
string = input()
numbers = sorted(map(int, string.split()))
values = []
for x in range(n - 1, 0, -1):
	values.append(numbers[x] - numbers[x - 1])
a = min(values)
print(a, values.count(a))


n = int(input())
dist = list(map(int, input().rstrip().split()))
dist = sorted(dist)
min_dist = 10 ** 20
count = 0
for i in range(n - 1):
	x = dist[i + 1] - dist[i]
	if x < min_dist:
		min_dist = x
		count = 1
	elif x == min_dist:
		count += 1
print(min_dist, count)


n = int(input())
b = sorted(map(int, input().split()))
temp = b[1] - b[0]
t = 1
for i in range(1, n - 1):
	dif = b[i + 1] - b[i]
	if dif < temp:
		temp = dif
		t = 1
	elif dif == temp:
		t += 1
print(temp, t)


from collections import defaultdict
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7

def readInts():
	return list(map(int, input().split()))

def I():
	return int(input())
n = I()
dic = defaultdict(int)
A = readInts()
A = sorted(A)
MIN = float('inf')
for i in range(n - 1):
	m = abs(A[i] - A[i + 1])
	dic[m] += 1
	if MIN > m:
		MIN = m
print(MIN, dic[MIN])


input()
n = sorted(map(int, input().split()))
m = -1
count = 0
for i in range(0, len(n) - 1):
	m1 = n[i + 1] - n[i]
	if m == -1 or m1 < m:
		m = m1
		count = 1
	elif m1 == m:
		count += 1
print(m, count)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
su = [abs(arr[i] - arr[i + 1]) for i in range(n - 1)]
y = min(su)
x = su.count(y)
print(y, x)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
m = 2 * 10 ** 9
k = 0
for i in range(1, n):
	if m > a[i] - a[i - 1]:
		m = a[i] - a[i - 1]
		k = 1
	elif m == a[i] - a[i - 1]:
		k += 1
print(str(m) + ' ' + str(k))


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
min = 10 ** 10
for i in range(1, len(a)):
	minimum = a[i] - a[i - 1]
	if minimum < min:
		min = minimum
		res = 1
	elif minimum == min:
		res += 1
print(min, res)


def main():
	n = int(input())
	cities = list(map(int, input().split()))
	cities.sort()
	minimum = float('inf')
	count = 0
	for i in range(len(cities) - 1):
		dif = abs(cities[i] - cities[i + 1])
		if dif == minimum:
			count += 1
		elif dif < minimum:
			minimum = dif
			count = 1
	print(minimum, count)
main()


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
r = []
for i in range(0, len(a) - 1):
	r.append(abs(a[i] - a[i + 1]))
r.sort()
print(r[0], r.count(r[0]))


total = 0
nums = []

def inp():
	global total, nums
	total = int(input())
	i = input()
	nums = i.split(' ')
	nums = [int(num) for num in nums]

def solve():
	global total, nums
	nums = sorted(nums)
	minx = 2000000001
	rs = {minx: 0}
	for i in range(total - 1):
		temp = abs(nums[i] - nums[i + 1])
		if temp <= minx:
			if temp < minx:
				rs[minx] = 0
			rs[minx] += 1
			rs[temp] = rs.pop(minx)
			minx = temp
	return rs
inp()
rs = solve()
print(list(rs.keys())[0], list(rs.values())[0])


n = eval(input())
a = list(map(int, input().split()))
a = sorted(a)
diff = a[1] - a[0]
f = 0
for i in range(1, n - 1):
	if a[i + 1] - a[i] < diff:
		diff = a[i + 1] - a[i]
for i in range(n - 1):
	if a[i + 1] - a[i] == diff:
		f += 1
print(diff, f)


n = int(input())
cities = sorted(map(int, input().split()))
mn = float('inf')
count = 0
for i in range(1, n):
	dist = cities[i] - cities[i - 1]
	if dist < mn:
		mn = dist
		count = 1
	elif dist == mn:
		count += 1
print(mn, count)


n = int(input())
l = list(sorted(map(int, input().split())))
(count, mi) = (0, 10000000000000)
for i in range(n - 1):
	d = abs(l[i + 1] - l[i])
	if d < mi:
		mi = d
		count = 1
	elif d == mi:
		count += 1
print(mi, count)


import sys
import math
inputLines = sys.stdin.readlines()
input = list(map(int, inputLines[1].split(' ')))
input.sort()
smallestDist = float('inf')
count = 0
for i in range(0, len(input) - 1):
	dist = abs(input[i] - input[i + 1])
	if dist < smallestDist:
		smallestDist = dist
		count = 1
	elif dist == smallestDist:
		count += 1
print(f'{smallestDist} {count}')


n = int(input())
l = sorted(list(map(int, input().split())))
ans = []
for i in range(1, n):
	ans.append(l[i] - l[i - 1])
ans = sorted(ans)
print(ans[0], ans.count(ans[0]))


a = int(input())
t = list(map(int, input().split()))
f = []
t.sort()
if a > 2:
	for k in range(a - 1):
		f.append(abs(t[k + 1] - t[k]))
	print(min(f), f.count(min(f)))
else:
	print(abs(t[0] - t[1]), 1)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = []
	for i in range(n - 1):
		c += [a[i + 1] - a[i]]
	print(min(c), c.count(min(c)))
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
mn = a[1] - a[0]
for i in range(1, n):
	if mn > a[i] - a[i - 1]:
		mn = a[i] - a[i - 1]
res = 0
for i in range(1, n):
	if a[i] - a[i - 1] == mn:
		res += 1
print(mn, res)


n = int(input())
line = sorted([int(x) for x in input().split(' ')])
diff = []
for i in range(n - 1):
	diff.append(line[i + 1] - line[i])
diff.sort()
y = diff[0]
count = 0
for x in diff:
	if x == y:
		count += 1
print(y, count)


from collections import defaultdict
import operator
import pprint
pp = pprint.PrettyPrinter(indent=4)
data = int(input())
nums = sorted(map(int, input().split()))
c = defaultdict(int)
for i in range(0, len(nums) - 1):
	c[nums[i + 1] - nums[i]] += 1
f = sorted(c.items())[0]
print(str(f[0]) + ' ' + str(f[1]))


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
n = int(input())
a = sorted(list(map(int, input().split())))
mini = 1e+18
count = 0
for i in range(0, len(a) - 1):
	if abs(a[i + 1] - a[i]) < mini:
		mini = abs(a[i + 1] - a[i])
		count = 1
	elif abs(a[i + 1] - a[i]) == mini:
		count += 1
print(mini, count)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
k = l[1] - l[0]
for i in range(2, n):
	k = min(k, abs(l[i] - l[i - 1]))
print(k, end=' ')
from collections import defaultdict
d = defaultdict(int)
ans = 0
for i in l:
	ans = ans + d[k + i] + d[i - k]
	d[i] += 1
print(ans)


n = int(input())
a = sorted(list(map(int, input().split())))
c = 0
dif = 10000000000.0
try:
	for i in range(n):
		dif = min(dif, abs(a[i] - a[i + 1]))
except:
	pass
try:
	for i in range(n):
		if abs(a[i] - a[i + 1]) == dif:
			c += 1
except:
	pass
print(dif, c)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
n = int(input())
l = list(map(int, input().split()))
l.sort()
x = dc(int)
m = sys.maxsize
for i in range(n - 1):
	p = abs(l[i] - l[i + 1])
	x[p] += 1
	m = min(m, p)
print(m, x[m])


import math
n = int(input())
b = []
a = sorted(list(map(int, input().split())))
for x in range(n - 1):
	b.append(abs(a[x] - a[x + 1]))
m = min(b)
print(m, b.count(m))


n = int(input())
c = list(map(int, input().split()))
c.sort()
dist = 0
cnt = 0
for (i, _) in enumerate(c):
	if cnt == 0:
		dist = c[i + 1] - c[i]
		cnt += 1
	else:
		d = c[i + 1] - c[i]
		if d < dist:
			dist = d
			cnt = 1
		elif d == dist:
			cnt += 1
	if i + 2 == n:
		break
print(dist, cnt)


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = 0
l = 2000000000
for i in range(1, n):
	if l > a[i] - a[i - 1]:
		l = a[i] - a[i - 1]
		k = 1
	elif l == a[i] - a[i - 1]:
		k += 1
print(l, k)


from sys import stdin
from collections import defaultdict
import math

def min_dist_nb(n, a):
	by_dist = defaultdict(int)
	min_dist = math.inf
	a.sort()
	for i in range(n - 1):
		dist = abs(a[i] - a[i + 1])
		if dist > min_dist:
			continue
		by_dist[dist] += 1
		min_dist = dist
	return (min_dist, by_dist[min_dist])
n = int(stdin.readline())
a = [int(s) for s in stdin.readline().split(' ')]
(min_dist, nb_pairs) = min_dist_nb(n, a)
print(f'{min_dist} {nb_pairs}')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
coun = []
for k in range(n - 1):
	coun.append(arr[k + 1] - arr[k])
zz = min(coun)
print(zz, coun.count(zz))


def find(A):
	A = sorted(A)
	MIN = 10 ** 10
	for i in range(1, len(A)):
		MIN = min(A[i] - A[i - 1], MIN)
	count = 0
	for i in range(1, len(A)):
		if MIN == A[i] - A[i - 1]:
			count += 1
	print(MIN, count)
input()
find(list(map(int, input().strip().split(' '))))


R = int(input())
arra = list(map(int, input().split()))
arra.sort()
smol = arra[1] - arra[0]
a = 1
for i in range(1, R - 1):
	if smol == arra[i + 1] - arra[i]:
		a = a + 1
	elif smol > arra[i + 1] - arra[i]:
		a = 1
	smol = min(smol, arra[i + 1] - arra[i])
print(smol, a)


n = int(input())
l = list(map(int, input().split()))
l.sort()
d = {}
q = int('1' + '0' * 20)
for x in range(n - 1):
	k = abs(l[x] - l[x + 1])
	if k in d:
		d[k] += 1
	else:
		d[k] = 1
	if k < q:
		q = k
print(q, d[q])


def getilist():
	return list(map(int, input().split()))
n = int(input())
a = sorted(getilist())
lb = 3000000000.0
c = 0
for i in range(n - 1):
	t = abs(a[i] - a[i + 1])
	if t == lb:
		c += 1
	if t < lb:
		lb = t
		c = 1
print(lb, c)


input()
a = sorted([int(i) for i in input().split()])
best = float('inf')
quantity = 0
for i in range(1, len(a)):
	diff = abs(a[i] - a[i - 1])
	if diff == best:
		quantity += 1
	elif diff < best:
		quantity = 1
		best = diff
print(best, quantity)


n = int(str(input()).strip())
a = sorted([int(x) for x in str(input()).split(' ')])
md = min([abs(a1 - a0) for (a0, a1) in zip(a, a[1:])])
print(md, sum([md == abs(a1 - a0) for (a0, a1) in zip(a, a[1:])]))


from collections import defaultdict
n = int(input())
A = sorted(map(int, input().split()))
c = defaultdict(int)
for i in range(n - 1):
	c[A[i + 1] - A[i]] += 1
r = min(c)
print(r, c[r])


def new_route(lst):
	(big, count) = (10 ** 18, 0)
	for i in range(1, len(lst)):
		f = lst[i] - lst[i - 1]
		if f == big:
			count += 1
		if f < big:
			(big, count) = (f, 1)
	return (big, count)
n = int(input())
a = [int(j) for j in input().split()]
print(*new_route(sorted(a)))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
n = ii()
a = li()
a.sort()
min_ = 2 * 10 ** 9 + 1
ans = 0
for i in range(n - 1):
	if a[i + 1] - a[i] == min_:
		ans += 1
	elif a[i + 1] - a[i] < min_:
		ans = 1
		min_ = a[i + 1] - a[i]
print(min_, ans)


import sys

def min_dist(array):
	minimo = float('Inf')
	for i in range(1, len(array)):
		aux = abs(array[i] - array[i - 1])
		if aux < minimo:
			minimo = aux
	return minimo

def count_difs(array, minimo):
	amount = 0
	for i in range(1, len(array)):
		aux = abs(array[i] - array[i - 1])
		if aux == minimo:
			amount += 1
	return amount
n = int(sys.stdin.readline().strip())
coordenadas = list(map(int, sys.stdin.readline().strip().split(' ')))
coordenadas.sort()
minimo = min_dist(coordenadas)
amount = count_difs(coordenadas, minimo)
print(minimo, amount)


from itertools import combinations
input()
cities = sorted(map(int, input().split()))
min_dist = 10 ** 18
min_count = 0
for i in range(len(cities) - 1):
	if abs(cities[i + 1] - cities[i]) < min_dist:
		min_dist = abs(cities[i + 1] - cities[i])
		min_count = 1
		continue
	if abs(cities[i + 1] - cities[i]) == min_dist:
		min_count += 1
print('{} {}'.format(min_dist, min_count))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
an = {}
l.sort()
for i in range(1, n):
	d = l[i] - l[i - 1]
	an[d] = an.get(d, 0) + 1
x = min(an)
print(x, an[x])


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
mn = 10000000000
k = 0
for i in range(1, n):
	s = abs(a[i - 1] - a[i])
	if s == mn:
		k += 1
	elif s < mn:
		mn = s
		k = 1
print(mn, k)


from sys import stdin

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
n = int(input())
ar = sorted(get_ints())
mind = 99999999999
for i in range(n - 1):
	mind = min(mind, abs(ar[i + 1] - ar[i]))
c = 0
for i in range(n - 1):
	if abs(ar[i + 1] - ar[i]) == mind:
		c += 1
print(mind, c)


n = int(input())
coord = list(map(int, input().split()))
coord.sort()
diff = []
for i in range(len(coord) - 1):
	diff.append(coord[i + 1] - coord[i])
diff.sort()
cnt = 0
for i in range(len(diff)):
	if diff[i] == diff[0]:
		cnt += 1
print(diff[0], cnt)


n = int(input())
a = list(sorted(map(int, input().split())))
(cnt, mi) = (0, 10000000000.0)
for i in range(n - 1):
	d = abs(a[i + 1] - a[i])
	if d < mi:
		mi = d
		cnt = 1
	elif d == mi:
		cnt += 1
print(mi, cnt)


n = int(input())
c = list(map(int, input().split()))
c.sort()
minn = 10 ** 10
e = 0
for i in range(len(c) - 1):
	d = c[i + 1] - c[i]
	if d < minn:
		e = 1
		minn = d
	elif d == minn:
		e += 1
print(minn, e)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
mini = 100000000000000
for i in range(0, len(arr) - 1):
	if mini > abs(arr[i] - arr[i + 1]):
		mini = abs(arr[i] - arr[i + 1])
for i in range(0, len(arr) - 1):
	if abs(arr[i] - arr[i + 1]) == mini:
		count += 1
print(mini, count)


n = input()
g = list(map(int, input().split()))
g.sort()
rlist = {}
for i in range(0, len(g) - 1):
	k = abs(g[i] - g[i + 1])
	if k in rlist:
		rlist[k] += 1
	else:
		rlist[k] = 1
m = min(rlist)
print(m, rlist[m])


n = int(input())
num = list(map(int, input().split(' ')))
num.sort()
c = 1
min_dif = num[1] - num[0]
for i in range(2, n, 1):
	dif = num[i] - num[i - 1]
	if min_dif > dif:
		min_dif = dif
		c = 1
	elif min_dif == dif:
		c += 1
print(min_dif, c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
minn = 2 * 10 ** 9
for i in range(n - 1):
	if minn > abs(a[i] - a[i + 1]):
		minn = abs(a[i] - a[i + 1])
x = 0
for i in range(n - 1):
	if minn == abs(a[i] - a[i + 1]):
		x += 1
print(minn, x)


def main():
	input()
	a = list(map(int, input().split()))
	a.sort()
	(mn, cnt) = (10 ** 18, 0)
	for i in range(1, len(a)):
		f = a[i] - a[i - 1]
		if f == mn:
			cnt += 1
		if f < mn:
			(mn, cnt) = (f, 1)
	print(mn, cnt)
main()


n = int(input())
count = 0
l = list(map(int, input().split()))
l.sort()
sub = []
for i in range(n - 1):
	sub.append(abs(l[i] - l[i + 1]))
sub.sort()
min = sub[0]
for x in sub:
	if x == min:
		count += 1
ans = []
ans.append(min)
ans.append(count)
print(ans[0], end=' ')
print(ans[1])


n = int(input())
a = sorted(list(map(int, input().split())))
(ans, k) = (a[-1] - a[0], 0)
for i in range(1, n):
	d = a[i] - a[i - 1]
	if d == ans:
		k += 1
	if d < ans:
		k = 1
		ans = d
print(ans, k)


__author__ = 'Alexander'
n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
b = [abs(a[i] - a[i + 1]) for i in range(len(a) - 1)]
m = min(b)
count = b.count(m)
print(m, count)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
d = {}
for i in range(len(a) - 1):
	d[a[i + 1] - a[i]] = 0
for i in range(len(a) - 1):
	d[a[i + 1] - a[i]] += 1
mini = 1000000000000000
for i in range(len(a) - 1):
	if mini > a[i + 1] - a[i]:
		mini = a[i + 1] - a[i]
print(mini, d[mini])


n = int(input().strip())
arr = list(map(int, input().strip().split(' ')))
arr.sort()
minD = 3 * 10 ** 9
for i in range(1, n):
	minD = min(minD, arr[i] - arr[i - 1])
count = 0
for i in range(1, n):
	if arr[i] - arr[i - 1] == minD:
		count += 1
print(minD, count)


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
a.sort()
for i in range(1, len(a)):
	d[a[i] - a[i - 1]] += 1
res = list(reversed(sorted(d))).pop()
print(res, d[res])


def solve():
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	a.sort()
	d_dict = {}
	for i in range(1, n):
		d = a[i] - a[i - 1]
		if d in d_dict:
			d_dict[d] += 1
		else:
			d_dict[d] = 1
	m = min(d_dict.keys())
	x = d_dict[m]
	return (m, x)
print(*solve())


a = input()
l = input()
l = [int(i) for i in l.split()]
ans = []
a = sorted(l)
for (x, y) in zip(a, a[1:]):
	ans.append(abs(x - y))
print(min(ans), ans.count(min(ans)))


n = int(input())
a = list(map(int, input().strip().split()))
a.sort()
diff = []
for i in range(n - 1):
	diff.append(a[i + 1] - a[i])
m = min(diff)
c = 0
for i in range(n - 1):
	if diff[i] == m:
		c += 1
print(str(m) + ' ' + str(c))


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
arr = [abs(arr[i] - arr[i + 1]) for i in range(n - 1)]
d = min(arr)
c = arr.count(d)
print(d, c)


n = int(input())
p = sorted(map(int, input().split()))
d = p[1] - p[0]
c = 1
for i in range(2, len(p)):
	if p[i] - p[i - 1] < d:
		d = p[i] - p[i - 1]
		c = 1
	elif p[i] - p[i - 1] == d:
		c += 1
print(d, c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a[1] - a[0]
c = 0
for i in range(1, n):
	if a[i] - a[i - 1] < m:
		m = a[i] - a[i - 1]
		c = 1
	elif a[i] - a[i - 1] == m:
		c += 1
print(m, c)


n = int(input())
l = list(map(int, input().split()))
l.sort()
mi = abs(l[0] - l[1])
cnt = 1
for i in range(1, len(l) - 1):
	d = abs(l[i] - l[i + 1])
	if d < mi:
		mi = d
		cnt = 1
	elif d == mi:
		cnt += 1
print(mi, end=' ')
print(cnt, end='')


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
min = 45655655464654566456456464464
count = 0
for i in range(1, n):
	if l[i] - l[i - 1] < min:
		min = l[i] - l[i - 1]
		count = 0
	if l[i] - l[i - 1] == min:
		count += 1
print(min, count, sep=' ')


n = int(input())
a = sorted(map(int, input().split()))
m = min((a[i] - a[i - 1] for i in range(1, n)))
print(m, sum((a[i] - a[i - 1] == m for i in range(1, n))))


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
k = []
for x in range(len(ls) - 1):
	k.append(ls[x + 1] - ls[x])
print(min(k), k.count(min(k)))


n = int(input())
L = list(map(int, input().split()))
L.sort()
d = [abs(L[i] - L[i - 1]) for i in range(1, n)]
a = min(d)
print(a, d.count(a))


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
l = [abs(ar[i + 1] - ar[i]) for i in range(0, n - 1)]
k = min(l)
print(k, l.count(k), sep=' ')


n = int(input())
l = list(map(int, input().split()))
from random import choice

def quick(liste):
	if len(liste) <= 1:
		return liste
	tes = choice(liste)
	kic = [i for i in liste if i < tes]
	ber = [k for k in liste if k == tes]
	boy = [m for m in liste if m > tes]
	return quick(kic) + ber + quick(boy)
l = quick(l)
mini = abs(l[0] - l[1])
d = {}
for i in range(len(l) - 1):
	t = abs(l[i] - l[i + 1])
	if t < mini:
		mini = t
	if t in d:
		d[t] += 1
	if not t in d:
		d[t] = 1
print(mini, d[mini])


n = int(input())
A = list(map(int, input().split(' ')))
A.sort()
mindiff = A[1] - A[0]
for i in range(1, n):
	mindiff = min(mindiff, A[i] - A[i - 1])
ct = 0
for i in range(1, n):
	if A[i] - A[i - 1] == mindiff:
		ct += 1
print(mindiff, ct)


from collections import deque
from collections import Counter
from sys import stdin
lines = deque((line.strip() for line in stdin.readlines()))

def nextline():
	return lines.popleft()

def types(cast):
	return tuple((int(x) for x in nextline().split()))

def ints():
	return types(int)

def strs():
	return nextline().split()

def main():
	(n,) = ints()
	coords = sorted(ints())
	counter = Counter((abs(coords[x] - coords[x + 1]) for x in range(len(coords) - 1)))
	m = min(counter.keys())
	print('{} {}'.format(m, counter[m]))
main()


n = int(input())
a = sorted([int(x) for x in input().split()])
r = 10 ** 10
cnt = 0
for i in range(n - 1):
	if a[i + 1] - a[i] < r:
		r = a[i + 1] - a[i]
		cnt = 1
	elif a[i + 1] - a[i] == r:
		cnt += 1
print(r, cnt)


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(1, n):
	if i == 1:
		min = a[i] - a[i - 1]
		countt = 1
	elif a[i] - a[i - 1] < min:
		countt = 1
		min = a[i] - a[i - 1]
	elif a[i] - a[i - 1] == min:
		countt += 1
print(min, end=' ')
print(countt)


n = int(input())
a = sorted([int(i) for i in input().split()])
m = abs(a[1] - a[0])
count = 0
for i in range(1, len(a)):
	t = abs(a[i] - a[i - 1])
	if t < m:
		m = t
		count = 1
	elif t == m:
		count += 1
print(m, count)


n = int(input())
a = list(map(int, input().split()))
dictSome = {}
sb = False
a.sort()
for i in range(0, len(a) - 1):
	k = abs(a[i] - a[i + 1])
	if k in dictSome.keys():
		dictSome[k] += 1
	else:
		dictSome[k] = 1
print(min(dictSome.keys()), dictSome[min(dictSome.keys())])


n = int(input())
l = list(map(int, input().split()))
l.sort()
mind = 10 ** 18
for i in range(n - 1):
	mind = min(mind, l[i + 1] - l[i])
count = 0
for i in range(n - 1):
	if l[i + 1] - l[i] == mind:
		count += 1
print(mind, count)


n = int(input())
a = list(map(int, input().split()))
minimum = abs(a[0] - a[1])
counter = 0
a.sort()
for i in range(1, n - 1):
	if abs(a[i] - a[i + 1]) < minimum:
		minimum = abs(a[i] - a[i + 1])
for i in range(n - 1):
	if abs(a[i] - a[i + 1]) == minimum:
		counter += 1
print(minimum, counter, sep=' ')


import sys
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
minr = sys.maxsize
k = 0
for i in range(len(a) - 1):
	m = a[i + 1] - a[i]
	if minr > m:
		minr = m
		k = 1
	elif minr == m:
		k += 1
print(minr, k)


3
import sys
n = int(sys.stdin.readline())
a = [int(x) for x in sys.stdin.readline().split()]
a.sort()
count = 0
dist = float('inf')
for i in range(n - 1):
	d = a[i + 1] - a[i]
	if d < dist:
		dist = d
		count = 1
	elif d == dist:
		count += 1
print(dist, count)


n = int(input())
lst = list(map(int, input().strip().split(' ')))
lst.sort()
m = 2 * 10 ** 9
t = 0
for j in range(1, n):
	if lst[j] - lst[j - 1] == m:
		t += 1
	elif lst[j] - lst[j - 1] < m:
		t = 1
		m = lst[j] - lst[j - 1]
print(m, t, end=' ')


n = int(input())
l = list(map(int, input().split()))
l.sort()
m = 10 ** 10
c = 1
x = []
for i in range(1, n):
	d = l[i] - l[i - 1]
	x.append(d)
	if d < m:
		m = d
print(m, x.count(m))


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = dict()
m = 99999999999999999999999
count = 0
for i in range(1, len(a)):
	if m > abs(a[i] - a[i - 1]):
		m = abs(a[i] - a[i - 1])
		count = 1
	elif m == abs(a[i] - a[i - 1]):
		count += 1
print(m, count)


n = int(input())
a = sorted(list(map(int, input().split())))
mind = a[1] - a[0]
cnt = 1
for i in range(2, n):
	if a[i] - a[i - 1] < mind:
		mind = a[i] - a[i - 1]
		cnt = 1
	elif a[i] - a[i - 1] == mind:
		cnt += 1
print(str(mind) + ' ' + str(cnt))


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
for i in range(n - 1):
	b.append(a[i + 1] - a[i])
print(min(b), b.count(min(b)))


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
mmn = lst[1] - lst[0]
cnt = 1
for i in range(n - 2):
	dif = lst[i + 2] - lst[i + 1]
	if dif < mmn:
		mmn = dif
		cnt = 1
	elif dif == mmn:
		cnt += 1
print(mmn, cnt)


n = int(input())
tab = [int(i) for i in input().split()]
tab.sort()
dist = []
for i in range(n - 1):
	dist.append(tab[i + 1] - tab[i])
x = min(dist)
y = dist.count(x)
print(x, y)


n = int(input())
a = [int(i) for i in input().split()]
min = 10 ** 9 * 2
x = 0
t = a.sort(reverse=True)
for i in range(n - 1):
	if abs(a[i] - a[i + 1]) < min:
		min = abs(a[i] - a[i + 1])
for i in range(n - 1):
	if abs(a[i] - a[i + 1]) == min:
		x += 1
print(min, ' ', x)


import math
import os
import random
import re
import sys

def mindist(n, list):
	list.sort()
	lista = []
	for i in range(n - 1):
		lista.append(list[i + 1] - list[i])
	mi = min(lista)
	count = lista.count(mi)
	return [mi, count]
n = int(input())
list = list(map(int, input().rstrip().split()))
[mi, count] = mindist(n, list)
print(str(mi) + ' ' + str(count))


num = int(input())
arr = list(map(int, input().split()))
arr.sort()
lst = []
for i in range(num - 1):
	lst.append(abs(arr[i + 1] - arr[i]))
print(min(lst), lst.count(min(lst)))


import math

def main():
	t = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	min = abs(arr[0] - arr[1])
	flag = 0
	for j in range(len(arr) - 1):
		if abs(arr[j] - arr[j + 1]) == min:
			flag += 1
		if abs(arr[j] - arr[j + 1]) < min:
			min = abs(arr[j] - arr[j + 1])
			flag = 1
	print(min, flag)
main()


b = int(input())
l = input().split(' ')
a = []
for n in l:
	a.append(int(n))
a.sort()
d = a[1] - a[0]
n = 0
for k in range(len(a) - 1):
	if d > a[k + 1] - a[k]:
		d = a[k + 1] - a[k]
		n = 1
	elif d == a[k + 1] - a[k]:
		n += 1
print(d, end=' ')
print(n)


input()
a = sorted(map(int, input().split()))
b = 10 ** 10
m = 0
for i in range(1, len(a)):
	c = a[i] - a[i - 1]
	if b == c:
		m += 1
	elif b > c:
		b = c
		m = 1
print(b, m)


from sys import stdin

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
n = ii()
a = li()
a.sort()
b = []
for i in range(1, n):
	b.append(a[i] - a[i - 1])
p = min(b)
print(p, b.count(p))


n = int(input())
a = sorted(map(int, input().split()))
(d, c) = (10000000000000000000000000, 1)
for x in range(n - 1):
	dx = a[x + 1] - a[x]
	if dx < d:
		d = dx
		c = 1
	elif dx == d:
		c += 1
print(d, c)


import math
n = int(input())
li = [int(x) for x in input().split()]
li.sort()
diff = math.inf
c = 0
for i in range(n - 1):
	temp = li[i + 1] - li[i]
	if temp == diff:
		c += 1
	elif temp < diff:
		diff = temp
		c = 1
print(diff, c)


N = int(input())
array = list(map(int, input().split()))
array.sort()
minimum = abs(array[0] - array[-1])
ans_amount = 0
for i in range(N - 1):
	if array[i + 1] - array[i] < minimum:
		ans_amount = 1
		minimum = array[i + 1] - array[i]
	elif array[i + 1] - array[i] == minimum:
		ans_amount += 1
print(minimum, end=' ')
print(ans_amount)


n = int(input())
num = list(map(int, input().split()))
num.sort()
arr = []
for i in range(n - 1):
	arr.append(abs(num[i + 1] - num[i]))
minn = 10000000000
for i in range(n - 1):
	if arr[i] < minn:
		minn = arr[i]
ans = arr.count(minn)
print(minn, ans)


n = int(input())
m = 10 ** 10
n = 1
(*a,) = map(int, input().split())
a.sort()
for i in range(1, len(a)):
	t = a[i] - a[i - 1]
	if t < m:
		c = 1
		m = t
	elif t == m:
		c += 1
print(m, c)


def cnt_req_edges(M, pos):
	cnt = 0
	for i in range(1, len(pos)):
		cnt += M == pos[i] - pos[i - 1]
	return cnt

def solve(n, a):
	M = 2000000000
	pos = sorted(a)
	for i in range(1, n):
		M = min(M, pos[i] - pos[i - 1])
	return (M, cnt_req_edges(M, pos))

def main():
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	print(*solve(n, a))
main()


import sys

def solve():
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	cnt = 0
	min_d = 4 * 10 ** 9
	for i in range(n - 1):
		if a[i + 1] - a[i] < min_d:
			cnt = 1
			min_d = a[i + 1] - a[i]
		elif a[i + 1] - a[i] == min_d:
			cnt += 1
	print(min_d, cnt)

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None

def __starting_point():
	solve()
__starting_point()


import sys
n = int(input())
a = sorted(map(int, input().split()))
(v1, v2) = (10 ** 18, 0)
for i in range(1, n):
	if a[i] - a[i - 1] < v1:
		v1 = a[i] - a[i - 1]
		v2 = 1
	elif v1 == a[i] - a[i - 1]:
		v2 += 1
print(v1, v2)


n = int(input())
f = [int(i) for i in input().split()][:n]
m = 123445678980
q = 0
f.sort()
for i in range(n - 1):
	k = min(abs(f[i] - f[i + 1]), abs(f[i] - f[i - 1]))
	m = min(m, k)
for i in range(n - 1):
	if abs(f[i] - f[i + 1]) == m:
		q += 1
print(m, q)


import math
n = int(input())
s = input()
array = []
result = set()
quantity = 1
for i in s.split():
	array.append(int(i))
array = sorted(array)
for i in range(len(array) - 1):
	num = abs(array[i] - array[i + 1])
	if len(result) != 0:
		if num < min(result):
			quantity = 1
			result.add(num)
		elif num == min(result):
			quantity += 1
	else:
		result.add(num)
print(min(result), quantity)


n = int(input())
x = sorted(list(map(int, input().split())))
a = []
for i in range(1, n):
	a.append([x[i - 1], x[i]])
a.sort(key=lambda x: x[1] - x[0])
cur_min = a[0][1] - a[0][0]
cur_cnt = 0
for j in range(len(a)):
	if a[j][1] - a[j][0] == cur_min:
		cur_cnt += 1
	else:
		break
print(cur_min, cur_cnt)


v = []
n = int(input())
p = [int(x) for x in input().split()]
p.sort()
for i in range(n - 1):
	d = p[i + 1] - p[i]
	v.append(d)
m = min((x for x in v))
print('%d %d' % (m, v.count(m)))


N = int(input())
L = list(map(int, input().split()))
L.sort()
mi = None
for i in range(1, N):
	if not mi:
		mi = L[i] - L[i - 1]
	else:
		mi = min(mi, L[i] - L[i - 1])
q = 0
for i in range(1, N):
	if L[i] - L[i - 1] == mi:
		q += 1
print(str(mi) + ' ' + str(q))


import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
for i in range(1, n):
	b.append(a[i] - a[i - 1])
b.sort()
num = 1
for i in range(1, n - 1):
	if b[i] != b[i - 1]:
		break
	num += 1
print(b[0], num)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
n = r()
a = rl()
a.sort()
mini = abs(a[1] - a[0])
for i in range(2, n):
	mini = min(mini, a[i] - a[i - 1])
cnt = 0
for i in range(1, n):
	if abs(a[i] - a[i - 1]) == mini:
		cnt += 1
print(mini, cnt)


n = int(input())
(*l,) = map(int, input().split())
l.sort()
d = []
for i in range(n - 1):
	d.append(l[i + 1] - l[i])
print(min(d), d.count(min(d)))


n = int(input())
l = sorted([int(i) for i in input().split()])
l1 = []
for i in range(n - 1):
	l1.append(l[i + 1] - l[i])
m = min(l1)
m1 = l1.count(m)
print(m, m1)


import sys
import math
import bisect

def solve(A):
	n = len(A)
	A.sort()
	min_dist = 10 ** 18
	for i in range(1, n):
		dist = A[i] - A[i - 1]
		min_dist = min(min_dist, dist)
	ans = 0
	for i in range(n):
		first = i + 1
		last = bisect.bisect_right(A, A[i] + min_dist, lo=i + 1)
		ans += last - first
	return (min_dist, ans)

def main():
	n = int(input())
	A = list(map(int, input().split()))
	ans = solve(A)
	print('%d %d' % (ans[0], ans[1]))
main()


n = int(input())
coordinates = input().split()
z = list(map(int, coordinates))
s = sorted(z)
m = 0
tot = 1
for i in range(n - 1):
	if i == 0:
		m = abs(s[i + 1] - s[i])
	else:
		diff = abs(s[i + 1] - s[i])
		if diff < m:
			m = diff
			tot = 1
		elif diff == m:
			tot += 1
print(m, tot)


import sys
a = input()
b = sys.stdin.readline().split()
cities = [int(elem) for elem in b]
cities.sort()
cities.reverse()
list_ = [abs(cities[i] - cities[i + 1]) for i in range(0, len(cities) - 1)]
list_.sort()
a = list_[0]
S = 0
for i in range(0, len(list_)):
	if list_[i] == a:
		S += 1
	else:
		pass
print('{0} {1}'.format(a, S))


n = int(input())
a = list(map(int, input().split()))
a.sort()
min_dist = 10 ** 10
min_count = 0
l = a[0]
for r in a[1:]:
	if r - l < min_dist:
		min_dist = r - l
		min_count = 1
	elif r - l == min_dist:
		min_count += 1
	l = r
print(min_dist, min_count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
m = 2000000005
f = 0
for i in range(n - 1):
	if abs(a[i] - a[i + 1]) < m:
		m = abs(a[i] - a[i + 1])
		c = 1
	elif abs(a[i] - a[i + 1]) == m:
		c += 1
	else:
		continue
print(m, c)


n = int(input())
l = list(map(int, input().split()))
lk = [None] * n
for i in range(n):
	lk[i] = [l[i], i + 1]
lk.sort()
d = abs(lk[1][0] - lk[0][0])
for i in range(1, n):
	if d > abs(lk[i - 1][0] - lk[i][0]):
		d = abs(lk[i - 1][0] - lk[i][0])
count = 0
for i in range(1, n):
	if d == abs(lk[i - 1][0] - lk[i][0]):
		count += 1
print(d, count)


def solve():
	n = int(input().rstrip())
	ls = list(map(int, input().rstrip().split()))
	ls.sort()
	mindist = 102000134234
	for i in range(1, len(ls)):
		mindist = min(mindist, ls[i] - ls[i - 1])
	count = 0
	for i in range(1, len(ls)):
		if ls[i] - ls[i - 1] == mindist:
			count += 1
	print(mindist, count)
solve()


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
b = [a[i] - a[i - 1] for i in range(1, n)]
b.sort()
m = b[0]
k = b.count(m)
print(m, k)


n = int(input())
r = list(map(int, input().split()))
r.sort()
m = min((r[i + 1] - r[i] for i in range(n - 1)))
d = {}
for i in range(n - 1):
	k = r[i + 1] - r[i]
	if k not in d:
		d[k] = 0
	d[k] += 1
print(m, d[m])


from collections import defaultdict
input()
nums = list(map(int, input().split()))
nums.sort()
diff_dict = defaultdict(int)
for i in range(len(nums) - 1):
	diff_dict[abs(nums[i + 1] - nums[i])] += 1
min_diff = min(diff_dict)
print(str(min_diff) + ' ' + str(diff_dict[min_diff]))


__author__ = 'Alexander'
n = input()
n = int(n)
s = input()
a = list(map(int, s.split()))
a.sort()
k = 0
m = None
for i in range(n - 1):
	d = a[i + 1] - a[i]
	if m is None or d < m:
		k = 1
		m = d
	elif d == m:
		k += 1
print(m, k)


num = int(input())
cityinput = input()
city = [int(n) for n in cityinput.split()]
city.sort()
dis1 = []
i = 0
while i < num - 1:
	dis1.append(abs(city[i] - city[i + 1]))
	i += 1
dis = min(dis1)
num_min = dis1.count(dis)
print(dis, num_min)


n = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 10 ** 200
count = 1
for i in range(1, n):
	if abs(A[i] - A[i - 1]) < ans:
		ans = abs(A[i] - A[i - 1])
		count = 1
	elif abs(A[i] - A[i - 1]) == ans:
		count += 1
print(ans, count)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
mn = 2 * 10 ** 9 + 2
cl = 0
for i in range(1, n):
	t = a[i] - a[i - 1]
	if t < mn:
		cl = 1
		mn = t
	elif t == mn:
		cl += 1
print(mn, cl)


x = int(input())
y = input()
a = [int(i) for i in y.split()]
a.sort()
b = []
i = 0
while i < len(a) - 1:
	b.append(abs(a[i] - a[i + 1]))
	i += 1
print(min(b), b.count(min(b)))


input()
get = lambda : list(map(int, input().split()))
arr = get()
arr.sort()
mind = float('inf')
l = len(arr)
i = 0
ans = 0
while i < l - 1:
	tmpd = abs(arr[i] - arr[i + 1])
	if tmpd < mind:
		mind = tmpd
		ans = 1
	elif tmpd == mind:
		ans += 1
	i += 1
print(mind, ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
dic = dict()
for i in range(1, n, 1):
	d = a[i] - a[i - 1]
	if d in dic:
		dic[d] += 1
	else:
		dic[d] = 1
dmin = 2000000000.0 + 7
mini = -1
for key in dic:
	if key < dmin:
		dmin = key
		mini = dic[key]
print(' '.join(map(str, [dmin, mini])))


n = int(input())
a = sorted([int(f) for f in input().split()])
m = 1 << 31
i = 1
for x in range(n - 1):
	d = abs(a[x] - a[x + 1])
	if d < m:
		m = d
		i = 1
	elif d == m:
		i += 1
print(m, i)


import sys, math, queue
sys.setrecursionlimit(1000000)
n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 10 ** 20
p = 0
for i in range(1, n):
	if a[i] - a[i - 1] < d:
		d = a[i] - a[i - 1]
		p = 1
	elif a[i] - a[i - 1] == d:
		p += 1
print(d, p)


n = eval(input())
arr = list(map(int, input().split(' ')))
arr.sort()
mi = 10000000000.0
cnt = 0
for i in range(0, n - 1):
	mi = min(mi, abs(arr[i] - arr[i + 1]))
for i in range(0, n - 1):
	if abs(arr[i] - arr[i + 1]) == mi:
		cnt = cnt + 1
print(mi, cnt)


n = int(input())
cities = [int(i) for i in input().split()]
cities.sort()
smallest = abs(cities[0] - cities[1])
times = 0
i = 0
while i < len(cities) - 1:
	if abs(cities[i] - cities[i + 1]) < smallest:
		smallest = abs(cities[i] - cities[i + 1])
		times = 1
	elif abs(cities[i] - cities[i + 1]) == smallest:
		times += 1
	i += 1
print(str(smallest) + ' ' + str(times))


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
from collections import defaultdict, Counter
from math import gcd
n = I()
ls = lint()
ls.sort()
arr = [0] * n
for i in range(n - 1):
	arr[i] = abs(ls[i + 1] - ls[i])
c = Counter(arr[:n - 1])
print(min(c.keys()), c[min(c.keys())])


n = int(input())
z = (n - 1) * [0]
a = [int(i) for i in input().split()]
a.sort()
for i in range(n - 1):
	z[i] = a[i + 1] - a[i]
print(min(z), z.count(min(z)))


n = int(input())
a = sorted(list(map(int, input().split())))
M = 1000000000000.0
res = 1
for i in range(n - 1):
	yy = a[i + 1] - a[i]
	if yy < M:
		M = yy
		res = 1
	elif yy == M:
		res += 1
print(*[M, res])


n = int(input())
an = [int(i) for i in input().strip().split(' ')]
an.sort()
min_dist = float('inf')
min_count = 0
for i in range(n - 1):
	dist = abs(an[i] - an[i + 1])
	if dist < min_dist:
		min_dist = dist
		min_count = 1
	elif dist == min_dist:
		min_count += 1
print('%s %s' % (min_dist, min_count))


n = int(input())
a = list(map(int, input().split()))
a.sort()
dis = 10000000000
quantity = 0
for i in range(n - 1):
	distance = abs(a[i] - a[i + 1])
	if distance < dis:
		dis = distance
		quantity = 0
	if distance == dis:
		quantity += 1
print(dis, quantity)


n = int(input())
num = list(map(int, input().split()))
num.sort()
mn = 10000000000
mc = 1
for i in range(1, n):
	val = abs(num[i] - num[i - 1])
	if val < mn:
		mn = val
		mc = 1
	elif val == mn:
		mc += 1
print(mn, mc)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
res_amount = 0
res = a[-1] - a[0]
for i in range(1, len(a)):
	if a[i] - a[i - 1] < res:
		res_amount = 1
		res = a[i] - a[i - 1]
		continue
	if a[i] - a[i - 1] == res:
		res_amount += 1
print('{0} {1}'.format(res, res_amount))


from sys import *
from collections import defaultdict
input = stdin.readline
listInput = lambda : list(map(int, input().strip().split()))
lineInput = lambda : map(int, input().strip().split())
sJoin = lambda a, sep: f'{sep}'.join(a)
arrJoin = lambda a, sep: f'{sep}'.join(map(str, a))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n) + 1), 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def main():
	n = int(input())
	arr = sorted(listInput())
	d = defaultdict(int)
	m = 10000000000000
	for i in range(1, n):
		s = abs(arr[i] - arr[i - 1])
		if s < m:
			m = s
		d[s] += 1
	print(m, d[m])
main()


from operator import sub
from bisect import bisect
n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(sub, a[1:], a))
d = b[0]
i = bisect(b, d)
print(d, i)


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
count = 0
m = 2 * pow(10, 9)
for i in range(n - 1):
	potential_min = abs(nums[i + 1] - nums[i])
	if potential_min < m:
		count = 1
		m = potential_min
	elif potential_min == m:
		count += 1
print(m, count)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	(m, nm) = (a[1] - a[0], 1)
	for i in range(1, n - 1):
		if a[i + 1] - a[i] < m:
			(m, nm) = (a[i + 1] - a[i], 1)
		elif a[i + 1] - a[i] == m:
			nm += 1
	print(m, nm)
main()


from collections import Counter
(n, a) = (int(input()), sorted(map(int, input().split())))
c = Counter((a[i + 1] - a[i] for i in range(n - 1)))
print(min(c), c[min(c)])


import sys
import collections
case = int(sys.stdin.readline())
dist = [int(x) for x in sys.stdin.readline().split(' ')]
dist = sorted(dist)
mini = float('inf')
q = 0
for i in range(1, len(dist)):
	if dist[i] - dist[i - 1] < mini:
		mini = dist[i] - dist[i - 1]
		q = 1
	elif dist[i] - dist[i - 1] == mini:
		q += 1
print(mini, q)


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
for j in range(1, n):
	b.append(a[j] - a[j - 1])
count = 1
b.sort()
for j in range(len(b) - 1):
	if b[j] == b[j + 1]:
		count += 1
	else:
		break
print(b[0], count)


n = int(input())
a = sorted(map(int, input().split()))
count = 0
best = 2 * 10 ** 9 + 1
for (s1, s2) in zip(a, a[1:]):
	d = abs(s1 - s2)
	if d == best:
		count += 1
	elif d < best:
		count = 1
		best = d
print(best, count)


n = int(input())
a = sorted(list(map(int, input().split())))
m = a[-1] - a[0]
k = 0
for i in range(len(a) - 1):
	if abs(a[i] - a[i + 1]) < m:
		m = abs(a[i] - a[i + 1])
		k = 1
	elif abs(a[i] - a[i + 1]) == m:
		k += 1
print(m, k)


n = int(input())
t = [int(x) for x in input().split()]
t.sort()
k = t[n - 1] - t[0]
l = 0
for i in range(1, n):
	if t[i] - t[i - 1] < k:
		k = t[i] - t[i - 1]
for i in range(1, n):
	if t[i] - t[i - 1] == k:
		l += 1
print(k, l)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	n = I()
	a = sorted(LI())
	m = inf
	r = -1
	for i in range(1, n):
		t = a[i] - a[i - 1]
		if t < m:
			m = t
			r = 1
		elif t == m:
			r += 1
	return '{} {}'.format(m, r)
print(main())


n = int(input())
a = list(map(int, input().split()))
diff = []
a.sort()
for i in range(1, len(a)):
	diff.append(abs(a[i] - a[i - 1]))
x = min(diff)
print(x, diff.count(x))


n = int(input())
l = list(map(int, input().split()))
l.sort()
min1 = float('inf')
count = 0
for i in range(n - 1):
	min1 = min(min1, l[i + 1] - l[i])
for i in range(n - 1):
	if l[i + 1] - l[i] == min1:
		count = count + 1
print(min1, count)


n = input()
L1 = input().split()
L = []
for i in L1:
	L.append(int(i))
ds = []
d = 10 ** 10
L.sort()
for i1 in range(0, len(L) - 1):
	diff = L[i1 + 1] - L[i1]
	if diff <= d:
		d = diff
		ds.append(diff)
num = ds.count(d)
print(d, num)


N = int(input())
X = sorted(list(map(int, input().split())))
(Count, Min) = (0, 10 ** 10)
for i in range(1, N):
	Min = min(Min, abs(X[i] - X[i - 1]))
	if Min == 1:
		break
for i in range(1, N):
	if abs(X[i] - X[i - 1]) == Min:
		Count += 1
print(Min, Count)


import math
n = int(input())
mass = [int(i) for i in input().split()]
list.sort(mass)
min = math.fabs(mass[0] - mass[1])
old = 0
i = 1
k = 0
while i < len(mass):
	summ = math.fabs(mass[old] - mass[i])
	if min > summ:
		k = 1
		min = summ
	elif min == summ:
		k += 1
	old = i
	i += 1
print(int(min), int(k))


n = int(input())
l = sorted(list(map(int, input().split())))
MIN = abs(l[0] - l[1])
count = 0
for i in range(n - 1):
	dist = abs(l[i] - l[i + 1])
	if dist < MIN:
		MIN = dist
		count = 1
	elif dist == MIN:
		count += 1
print(MIN, count)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
minimum = int(10000000000)
for i in range(n - 1):
	if arr[i + 1] - arr[i] < minimum:
		minimum = arr[i + 1] - arr[i]
count = 0
for i in range(n - 1):
	if arr[i + 1] - arr[i] == minimum:
		count += 1
print(minimum, count)


num = int(input())
coms = list(map(int, input().split()))
coms.sort()
counter = 0
less = 2 * 10 ** 9
for i in range(1, num):
	if coms[i] - coms[i - 1] < less:
		counter = 1
		less = coms[i] - coms[i - 1]
	elif coms[i] - coms[i - 1] == less:
		counter += 1
print(less, counter)


n = int(input())
arr = [int(el) for el in input().split()]
arr.sort(reverse=False)
d = []
for i in range(n - 1):
	d.append(arr[i + 1] - arr[i])
min = d[0]
j = 0
for el in d:
	if el < min:
		min = el
for el in d:
	if el == min:
		j += 1
print(min, j)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
m = []
c = 0
for i in range(len(a) - 1):
	p = abs(a[i] - a[i + 1])
	m.append(p)
y = min(m)
for x in m:
	if y == x:
		c += 1
print(f'{y} {c}')


import math
n = int(input())
temp = input()
tab = temp.split(' ')
i = 0
while i < len(tab):
	tab[i] = int(tab[i])
	i += 1
diff = math.fabs(tab[0] - tab[-1])
res = 0
tab.sort()
i = 1
while i < len(tab):
	if math.fabs(tab[i] - tab[i - 1]) < diff:
		res = 1
		diff = math.fabs(tab[i] - tab[i - 1])
	elif math.fabs(tab[i] - tab[i - 1]) == diff:
		res += 1
	i += 1
print(int(diff), res)


n = int(input())
num = input().split()
i = 0
num = list(map(int, num))
num.sort()
d = abs(num[0] - num[1])
i = 1
j = 2
k = 1
while j < n:
	if abs(num[i] - num[j]) < d:
		k = 1
		d = abs(num[i] - num[j])
	elif abs(num[i] - num[j]) == d:
		k = k + 1
	i = i + 1
	j = j + 1
print(d, k)


from sys import stdin
inFile = stdin
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = inFile.readline().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
n = nextInt()
a = sorted([nextInt() for _ in range(n)])
min_dis = (10 ** 10, 0)
for i in range(len(a) - 1):
	cur = abs(a[i] - a[i + 1])
	if cur < min_dis[0]:
		min_dis = (cur, 1)
	elif cur == min_dis[0]:
		min_dis = (min_dis[0], min_dis[1] + 1)
print('{} {}'.format(min_dis[0], min_dis[1]))


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
diffs = [a[i] - a[i - 1] for i in range(1, n)]
diffs.sort()
cur = 0
while cur < n - 1 and diffs[cur] == diffs[0]:
	cur += 1
print(diffs[0], cur)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
pre = a[0]
num = float('inf')
pair = 0
for i in range(1, n):
	if num > abs(a[i] - pre):
		pair = 1
		num = abs(a[i] - pre)
	elif num == abs(a[i] - pre):
		pair += 1
	pre = a[i]
print(num, pair)


n = int(input())
array = list(map(int, input().split()))
array = sorted(array)
mink = array[-1] - array[0]
count = 0
for i in range(1, len(array)):
	if mink > array[i] - array[i - 1]:
		mink = array[i] - array[i - 1]
		count = 1
	elif mink == array[i] - array[i - 1]:
		count += 1
print(mink, count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a[1] - a[0]
cnt = 0
for i in range(1, len(a)):
	if a[i] - a[i - 1] == m:
		cnt += 1
	elif a[i] - a[i - 1] < m:
		m = a[i] - a[i - 1]
		cnt = 1
ans = str(m) + ' ' + str(cnt)
print(ans)


n = int(input())
a = list(map(int, input().split()))
ans = []
a.sort()
for i in range(n - 1):
	ans.append(abs(a[i] - a[i + 1]))
ans.append(abs(a[n - 1] - a[0]))
if n == 2:
	print(min(ans), 1)
else:
	print(min(ans), ans.count(min(ans)))


n = int(input())
V = [int(x) for x in input().split()]
V = sorted(V)
cont = 0
men = 3000000000
for i in range(n - 1):
	if abs(V[i] - V[i + 1]) < men:
		men = abs(V[i] - V[i + 1])
		cont = 1
	elif abs(V[i] - V[i + 1]) == men:
		cont += 1
print(men, cont)


n = int(input())
a = sorted(list(map(int, input().split())))
diff = 20000000000
c = 0
for i in range(1, n):
	if abs(a[i] - a[i - 1]) < diff:
		diff = abs(a[i] - a[i - 1])
for i in range(1, n):
	if abs(a[i] - a[i - 1]) == diff:
		c += 1
print(diff, c)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
count = 0
mn = 7000000000
i = 1
while i < len(a):
	if mn > abs(a[i] - a[i - 1]):
		mn = abs(a[i] - a[i - 1])
		count = 1
	elif mn == abs(a[i] - a[i - 1]):
		count += 1
	i += 1
print(mn, count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
min = 1000000000000000000
fin = 0
for i in range(1, n):
	if min > abs(a[i - 1] - a[i]):
		min = abs(a[i - 1] - a[i])
		fin = 0
	if min == abs(a[i - 1] - a[i]):
		fin += 1
print(min, fin)


n = int(input())
mn = 2 * 10 ** 9 + 1
a = [int(i) for i in input().split()]
a.sort()
cnt = 0
for i in range(n - 1):
	x = abs(a[i] - a[i + 1])
	if x < mn:
		mn = x
		cnt = 1
	elif x == mn:
		cnt = cnt + 1
print(mn, cnt)


n = int(input())
a = list(map(int, input().split(' ')))
a = sorted(a)
m = a[1] - a[0]
for i in range(2, len(a)):
	if a[i] - a[i - 1] < m:
		m = a[i] - a[i - 1]
count = 0
for i in range(1, len(a)):
	if a[i] - a[i - 1] == m:
		count = count + 1
print(m, count)


num_cities = int(input())
coords = list(map(int, input().split(' ')))
coords.sort()
min_dist = coords[1] - coords[0]
min_dist_count = 1
for i in range(2, len(coords)):
	diff = abs(coords[i] - coords[i - 1])
	if diff == min_dist:
		min_dist_count += 1
	elif diff < min_dist:
		min_dist = diff
		min_dist_count = 1
print(min_dist, min_dist_count)


n = int(input())
coord = sorted(tuple(map(int, input().split(' '))))
lengths = []
for i in range(n - 1):
	lengths.append(abs(coord[i] - coord[i + 1]))
lengths.sort()
print(str(lengths[0]) + ' ' + str(lengths.count(lengths[0])))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
mi = a[1] - a[0]
c = 1
for i in range(2, n):
	if mi > a[i] - a[i - 1]:
		mi = a[i] - a[i - 1]
		c = 1
	elif mi == a[i] - a[i - 1]:
		c += 1
print(mi, c)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
res = []
for i in range(n - 1):
	res.append(abs(a[i] - a[i + 1]))
m = min(res)
c = 0
for x in sorted(res):
	if x == m:
		c += 1
	else:
		break
print(m, c)


n = int(input())
arr = sorted(list(map(int, input().split())))
mini = [arr[i] - arr[i - 1] for i in range(1, n)]
m = min(mini)
print(int(m), mini.count(m))


n = int(input())
coords = sorted(map(int, input().split()))
diffs = [coords[i] - coords[i - 1] for i in range(1, n)]
minimum = min(diffs)
total = diffs.count(minimum)
print(minimum, total)


n = int(input())
ip = input().split(' ')
ip2 = list(map(int, ip))
ips = sorted(ip2)
temp = float('inf')
mim = 0
for x in range(len(ips)):
	if x != len(ips) - 1:
		if abs(ips[x] - ips[x + 1]) < temp:
			temp = abs(ips[x] - ips[x + 1])
			mim = 1
		elif abs(ips[x] - ips[x + 1]) == temp:
			mim = mim + 1
print(temp, mim)


n = int(input())
b = [int(i) for i in input().split()]
b.sort()
p = []
for i in range(1, n):
	p.append(abs(b[i] - b[i - 1]))
z = min(p)
t = 0
for i in range(1, n):
	if abs(b[i] - b[i - 1]) == z:
		t += 1
print(z, t)


import math
n = int(input())
arr = sorted(list(map(int, input().split())))
min_v = math.inf
cnt = 0
for i in range(n - 1):
	x = abs(arr[i] - arr[i + 1])
	if x <= min_v:
		if x == min_v:
			cnt += 1
		else:
			min_v = x
			cnt = 1
print(min_v, cnt)


n = int(input())
arr = list(map(int, input().split()))
arg = []
arr.sort()
for i in range(1, len(arr)):
	arg.append(abs(arr[i] - arr[i - 1]))
x = min(arg)
print(x, arg.count(x))


n = input()
a = [int(x) for x in input().split(' ')]
a = sorted(a)
i = len(a) - 1
d = {}
m = 1000000000000
while i > 0:
	key = int(a[i]) - int(a[i - 1])
	m = min(m, key)
	if key in d:
		d[key] += 1
	else:
		d[key] = 1
	i -= 1
print(str(m) + ' ' + str(d[m]))


import sys, copy
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
arr.sort()
res = []
num = dict().fromkeys(set(arr), 0)
for i in range(n - 1):
	res.append(abs(arr[i] - arr[i + 1]))
for i in arr:
	num[i] += 1
temp = min(res)
ans = 0
for i in arr:
	if i - temp in num:
		ans += num[i - temp]
	if i + temp in num:
		ans += num[i + temp]
print(temp, ans // 2)


n = int(input())
cities = sorted(map(int, input().strip().split()))
distances = sorted([abs(cities[i] - cities[i + 1]) for i in range(0, n - 1)])
print(distances[0], len(list(filter(lambda x: x == distances[0], distances))))


import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
distance = 2000000000
pair = 0
for i in range(1, n):
	if abs(a[i] - a[i - 1]) < distance:
		distance = min(distance, a[i] - a[i - 1])
		pair = 1
	elif abs(a[i] - a[i - 1]) == distance:
		pair += 1
print(distance, pair)


n = input()
a = sorted(map(int, input().strip().split()))
d = [c2 - c1 for (c1, c2) in zip(a, a[1:])]
m = min(d)
print(f'{m} {d.count(m)}')


n = int(input())
points = [int(x) for x in input().split(' ')]
points.sort()
min = 99999999999999999999999
count = 0
for i in range(len(points) - 1):
	distance = abs(points[i + 1] - points[i])
	if distance < min:
		min = distance
		count = 1
	elif min == distance:
		count += 1
print('{0} {1}'.format(min, count))


n = int(input())
arr = [int(i) for i in input().split(' ')]
arr.sort()
min_l = arr[1] - arr[0]
c = 1
for i in range(2, n):
	l = arr[i] - arr[i - 1]
	if l < min_l:
		min_l = l
		c = 1
	elif l == min_l:
		c += 1
print(min_l, c)


n = int(input())
ai = list(map(int, input().split()))
ai.sort()
mini = 10000000000000
num = 0
for i in range(n - 1):
	num2 = ai[i + 1] - ai[i]
	if mini > num2:
		mini = num2
		num = 1
	elif mini == num2:
		num += 1
print(mini, num)


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
mr = 10 ** 10
num = 0
for i in range(1, n):
	if ar[i] - ar[i - 1] < mr:
		mr = ar[i] - ar[i - 1]
		num = 1
	elif ar[i] - ar[i - 1] == mr:
		num += 1
print(mr, num)


import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
k = sys.maxsize
c = 0
for I in range(1, n):
	if k > a[I] - a[I - 1]:
		k = a[I] - a[I - 1]
for I in range(1, n):
	if k == a[I] - a[I - 1]:
		c += 1
print(k, c)


n = int(input())
tab = sorted([int(x) for x in input().split()])
min_dist = 2 * 10 ** 9 + 2
for i in range(n - 1):
	min_dist = min([min_dist, tab[i + 1] - tab[i]])
amount = 0
for i in range(n - 1):
	if tab[i + 1] - tab[i] == min_dist:
		amount += 1
print(min_dist, amount)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
am = 0
min = 2000000000
for i in range(n - 1):
	if a[i + 1] - a[i] < min:
		am = 1
		min = a[i + 1] - a[i]
	elif a[i + 1] - a[i] == min:
		am += 1
print(min, am)


import math
input1 = list(map(int, input().split()))
input2 = list(map(int, input().split()))
min = 10000000000.0
quantity = 0
input2.sort()
for i in range(len(input2) - 1):
	if math.fabs(input2[i + 1] - input2[i]) < min:
		quantity = 1
		min = math.fabs(input2[i + 1] - input2[i])
	elif math.fabs(input2[i + 1] - input2[i]) == min:
		quantity += 1
print(str(int(min)) + ' ' + str(quantity))


from itertools import islice

def min_distance(cities):
	cities = sorted(cities)
	minimum = float('+inf')
	count = 0
	for (A, B) in zip(islice(cities, len(cities) - 1), islice(cities, 1, None)):
		distance = abs(B - A)
		if distance < minimum:
			minimum = distance
			count = 1
		elif distance == minimum:
			count += 1
	return (minimum, count)

def main():
	count = int(input())
	cities = map(int, input().strip().split())
	(distance, count) = min_distance(cities)
	print(distance, count)
main()


n = int(input())
l = list(map(int, input().split()))
nl = list()
l.sort()
for i in range(1, n):
	nl.append(abs(l[i] - l[i - 1]))
nl.sort()
c = 0
for i in range(1, n):
	if abs(l[i] - l[i - 1]) == nl[0]:
		c += 1
print(nl[0], c, sep=' ')


import sys
import bisect as bi
import math as mt
import collections as cc
import heapq as hp
I = lambda : list(map(int, input().split()))
(n,) = I()
l = sorted(I())
ans = {}
for i in range(n - 1):
	x = abs(l[i] - l[i + 1])
	ans[x] = ans.get(x, 0) + 1
temp = min(ans.keys())
print(temp, ans[temp])


MAX = 20000000000.0

def solution(nums):
	dis = dict()
	dista = MAX
	for i in range(0, len(nums) - 1):
		mini = abs(nums[i] - nums[i + 1])
		if dis.get(mini) == None:
			dis[mini] = 1
		else:
			dis[mini] += 1
		dista = min(dista, mini)
	return '{} {}'.format(dista, dis[dista])

def main():
	n = input()
	nums = sorted([int(x) for x in input().split()])
	print(solution(nums))
main()


n = int(input())
a = sorted((int(i) for i in input().split()))
b = [abs(a[i] - a[i + 1]) for i in range(n - 1)]
m = min(b)
c = b.count(m)
print(m, c)


n = int(input())
list1 = list(map(int, input().split(' ')))
list1.sort()
min = list1[-1] - list1[0]
for i in range(0, n - 1):
	if list1[i + 1] - list1[i] < min:
		min = list1[i + 1] - list1[i]
count = 0
for i in range(0, n - 1):
	if list1[i + 1] - list1[i] == min:
		count += 1
print(min, count)


n = int(input())
L = input()
l = L.split()
l = [int(x) for x in l]
l.sort()
m = l[1] - l[0]
for i in range(n - 1):
	if l[i + 1] - l[i] < m:
		m = l[i + 1] - l[i]
p = 0
for i in range(n - 1):
	if l[i + 1] - l[i] == m:
		p += 1
print(m, p, sep=' ')


n = int(input())
a = sorted(map(int, input().split()))
(mi, k) = (100000000000, 0)
for i in range(1, n):
	if mi > a[i] - a[i - 1]:
		mi = a[i] - a[i - 1]
		k = 1
	elif mi == a[i] - a[i - 1]:
		k += 1
print(mi, k)


n = int(input())
l = list(map(int, input().split()))
l.sort()
m = 3 * 1000000000.0
nb = 0
for i in range(len(l) - 1):
	if l[i + 1] - l[i] == m:
		nb += 1
	if l[i + 1] - l[i] < m:
		m = l[i + 1] - l[i]
		nb = 1
print(m, nb, sep=' ', end='\n')


N = int(input())
points = [int(n) for n in input().split()]
points.sort()
pairs = 0
min_dist = float('inf')
distance = [points[i + 1] - points[i] for i in range(N - 1)]
for i in range(N - 1):
	if distance[i] < min_dist:
		min_dist = distance[i]
		pairs = 1
	elif distance[i] == min_dist:
		pairs += 1
print(min_dist, pairs)


n = int(input())
str_arr = input().split(' ')
arr = [int(num) for num in str_arr]
arr.sort()
a = []
i = 1
while i < n:
	a.append(arr[i] - arr[i - 1])
	i += 1
mindist = min(a)
count = 0
i = 1
while i < n:
	if arr[i] - arr[i - 1] == mindist:
		count += 1
	i += 1
print(str(mindist) + ' ' + str(count))


n = int(input())
coords = list(sorted(map(int, input().split())))
distances = []
for i in range(1, n):
	distances.append(coords[i] - coords[i - 1])
ans = min(distances)
print(ans, distances.count(ans))


n = int(input())
a = [int(x) for x in input().split()]
mx = 10 ** 100
ct = 0
a.sort()
for (x, y) in zip(a, a[1:]):
	if y - x < mx:
		mx = y - x
		ct = 1
	elif y - x == mx:
		ct += 1
print(mx, ct)