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 = 1; i < B; i++) { if (i != A) cnt++; } } else { for (long i = 1; i < B; i++) { cnt++; } } System.out.println(cnt); } }