N=int(input()) A=list(map(int,input().split())) n,x,c=min(A),max(A),A.count print(*((c(x), c(n)),((N,0),(0,N))[n//(N-1)>2])[n==x])