n,*a=$<.read.split.map &:to_i $><<(a|[]==[b=a[0]]?b/~-n<4?[n,0]:[0,n]:a.minmax.rotate.map{|i|a.count i})*' '