#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define all(x) x.begin(), x.end()
using namespace std;
const int maxn = 2e5 + 1;
ll sc12, sc6, sc, x, res = 0, d;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll m, n;
cin >> m >> n;
d = n - m + 1;
res += (n - (m / 2) * 2 - 1)/2 + 1;
sc = d - res;
ll y = (m + 5) / 6 * 6;
if(y<=n) sc6 = (n - y) / 6 + 1;
else sc6 = 0;
res += (sc - sc6) * 2;
x = (m + 11) / 12 * 12;
if (x <= n) sc12 = (n - x) / 12 + 1;
else sc12 = 0;
res += sc12 * 2;
res += (sc6 - sc12) * 3;
cout << res;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSB1bGwgdW5zaWduZWQgbG9uZyBsb25nCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgYWxsKHgpIHguYmVnaW4oKSwgeC5lbmQoKQp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgbWF4biA9IDJlNSArIDE7CmxsIHNjMTIsIHNjNiwgc2MsIHgsIHJlcyA9IDAsIGQ7CmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsgY2luLnRpZSgwKTsgY291dC50aWUoMCk7CiAgICBsbCBtLCBuOwogICAgY2luID4+IG0gPj4gbjsKICAgIGQgPSBuIC0gbSArIDE7CiAgICByZXMgKz0gKG4gLSAobSAvIDIpICogMiAtIDEpLzIgKyAxOwogICAgc2MgPSBkIC0gcmVzOwogICAgbGwgeSA9IChtICsgNSkgLyA2ICogNjsKICAgIGlmKHk8PW4pIHNjNiA9IChuIC0geSkgLyA2ICsgMTsKICAgIGVsc2Ugc2M2ID0gMDsKICAgIHJlcyArPSAoc2MgLSBzYzYpICogMjsKICAgIHggPSAobSArIDExKSAvIDEyICogMTI7CiAgICBpZiAoeCA8PSBuKSBzYzEyID0gKG4gLSB4KSAvIDEyICsgMTsKICAgIGVsc2Ugc2MxMiA9IDA7CiAgICByZXMgKz0gc2MxMiAqIDI7CiAgICByZXMgKz0gKHNjNiAtIHNjMTIpICogMzsKICAgIGNvdXQgPDwgcmVzOwoKCn0KCg==