import math n = int(input()) A = list(map(int,input().strip().split())) x = min(A) y = max(A) s = sum(A) print("%d %d %d"%(x,y,s))