
object Main {
	def main(args: Array[String]): Unit = {
			val in = new java.util.Scanner(System.in)
					val n = in.nextInt()
					var list= List.empty[Int] 
							for(i <-1 to n){
								val a = in.nextInt()
										list = a::list
							}
			list.reverse
			println(list.min+" " +list.max+" "+list.sum)   
	}

}