N = int(input()) line = input().split() line = sorted(line) df_old = 1000000 #print(line) for i in range(N -1): df_new = int(line[i + 1]) - int(line[i]) #print(abs(df_new), abs(df_old)) if abs(df_new) < abs(df_old): df_old = df_new print(abs(int(line[0]) - int(line[N - 1]))) print(df_old)