INUM - Interesting Numbers

Jack and Jill went up the hill. Jack proposed Jill after reaching at the top of the hill. Jill gave Jack 'N' numbers and asked him to choose a pair of numbers such that their absolute difference is minimum. She also asked him to choose a pair of numbers such that their absolute difference is maximum. Jill wondered just finding maximum and minimum values is mainstream and it will be a cakewalk for Jack, instead she asked him to find number of pairs which have minimum absolute difference and number of pairs which have maximum absolute difference.

Jill will accept Jack's proposal only if he can answer her question correctly. Jack does not know programming. Fortunately Jack had his laptop with him, fully charged and with good internet connection. He mailed you the numbers and asked you to mail him the answers back, as you are known to be a good programmer. Now it's your turn to help him.

Input

First line contains a positive integer 'N'. Next line contains 'N' non-negative integers 'a[i]' separated by a single space.

Output

Print the number of pairs having minimum and maximum difference separated by a single space.

Constraints

1 ≤ N ≤ 105

0 ≤ a[i] ≤ 1015

Sample

Input:
5
5 12 8 1 35

Output:
1 1

Explanation

It's optimal to choose the pair (5, 8) for the minimum difference. So only 1 pair.

It's optimal to choose the pair (1, 35) for the maximum difference. Here also only 1 pair.


Added by:Aayush Agarwal
Date:2014-08-30
Time limit:1s-2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own problem used for codecracker , co-authored by Rana Saha

hide comments
2014-09-16 19:00:50 maradona
uncountable WA because i saw 10^15 as 10^5 -_-
2014-09-03 13:42:59 Baojun Wang
be care of file ending, likely there is no '\n' for the 2nd line but just an EOF instead.
2014-09-03 13:42:59 abhi
wrong ans without any reason
2014-09-03 13:42:59 tushar aggarwal
so if 1 1 1 is test case
then min pairs are 3 or 2 ??
1,1 1,1 1,1 ?
its keep on giving compilation error..

Last edit: 2014-08-31 14:55:33
2014-09-03 13:42:59 anand pandey
can u provide some good test cases???
2014-09-03 13:42:59 The_ROCK
and yeah the constraint on N must be 2<=N<=10^5

Re : It doesn't matter , N=1 has a valid answer.

Last edit: 2014-08-31 08:23:54
2014-09-03 13:42:59 Aayush Agarwal
Its total number of pairs . Don't assume anything that is not mentioned in the problem statement.
2014-09-03 13:42:59 The_ROCK
is it distinct pairs or total number of pairs??

Last edit: 2014-08-30 23:32:17
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.