import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long A = Integer.parseInt(sc.next()); long B = Integer.parseInt(sc.next()); long cnt = 0; if (A > B) { for (long i = A + 1; i <= 2000000000; i++) { cnt++; } } else { for (long i = A - 1; i > 0; i--) { cnt++; } for (long i = A + 1; i < B; i++) { cnt++; } } System.out.println(cnt); } }