#include "bits/stdc++.h"
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	int ANS = 0;
	for (int i = A; i <= B; i++) {
		if ((A + B + i) % 3 == 0) ANS++;
	}
	cout << ANS << endl;
}