const [l1, l2] = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
const n = Number(l1);
let max,
  min,
  sum = 0;
const ns = l2.split(" ");
for (let i = 0; i < n; i++) {
  const v = Number(ns[i]);
  if (max == null) {
    max = v;
    min = v;
  } else {
    max = Math.max(max, v);
    min = Math.min(min, v);
  }
  sum += v;
}

console.log(`${min} ${max} ${sum}`);

