a=int(input()) b=[int(i) for i in input().split()] c=0 del b[b.index(max(b))] del b[b.index(min(b))] for i in b: c+=i print(c/(a-2))