function main(input) {
  const args = input.split('\n')[1].split(' ').map((n) => parseInt(n));
  var difference = 0;
  args.sort((a, b) => b - a).forEach((n, i) => {
  	(n % 2 === 0)? difference += i : difference -= i;
  });
  console.log(difference);
}

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