import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] strAry = sc.next().split(""); int[] intAry = new int[3]; for (int i = 0; i < 3; i++) { intAry[i] = Integer.parseInt(strAry[i]); } int max = Math.max(Math.max(intAry[0], intAry[1]), intAry[2]); int min = Math.min(Math.min(intAry[0], intAry[1]), intAry[2]); int result = max - min; System.out.println(result); sc.close(); } }