var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

var kumiawase = [
  [0,1,2],
  [0,2,1],
  [1,0,2],
  [1,2,0],
  [2,0,1],
  [2,1,0]
];
var main = function() {
  var i;
  var cost;
  var mincost;
  var splitlist;

  splitlist = lines[0].split(" ");

  mincost = 200;
  for(i = 0; i < 6; i++){
    cost =  Math.abs(Number(splitlist[kumiawase[i][1]]) - Number(splitlist[kumiawase[i][0]]));
    cost += Math.abs(Number(splitlist[kumiawase[i][2]]) - Number(splitlist[kumiawase[i][1]]));
    if(mincost > cost){
      mincost = cost;
    }
  }
  console.log(mincost);
}

reader.on('line', function(line) {
  lines.push(line);
});
reader.on('close', function() {
  main();
});
