import java.util.*; public class Main{ static StringBuilder sb = new StringBuilder(""); public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int I = A; int k =0; for (int i = A;i <= B ;i++ ) { if ((A+B+I)%3==0) { k++; I++; }else{ I++; } } System.out.println(k); } }