'use strict'

function main(s) {
  s = s.split('\n');

  const arr = s[1].split(' ').map(n => Number(n));
  const ans = Math.abs(Math.max(...arr) - Math.min(...arr));
  
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
