'use strict'

const main = (INPUT) => {
  const AAry = INPUT.split('\n')[1].split(' ')
  AAry.sort((a, b) => a - b)
  console.log(AAry[AAry.length - 1] - AAry[0])
}

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