const input = require('fs').readFileSync('/dev/stdin', 'UTF-8');

const minMaxSum = input => {
  const array = [
    ...input
      .split('\n')[1]
      .split(' ')
      .map(Number)
  ];
  const min = Math.min(...array);
  const max = Math.max(...array);
  const sum = array.reduce((acc, current) => acc + current);
  console.log([min, max, sum].join(' '));
};

minMaxSum(input);

