N = input() x = map(int,raw_input().split()) D = list(set(x)) D.sort(reverse=True) if len(D) == 1: print abs(D[0]) else: print abs(D[0]-D[1])