var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var a=input.trim().split("\n");
var x=a[1].split(" ").map(Number);
var min=Math.min(...x);
var max=Math.max(...x);
var s=max-min;
if(s%2==0)console.log(s/2);
else console.log((s+1)/2);

