#include <cstdio>

using namespace std;

typedef unsigned long long ull;

ull dp[32][ (1<<18) ];

inline void generateDP(const int &br)
{
    int i,j,r,mask,newMask;
    for ( mask = 0; mask < 32; mask++ )
        dp[0][ (mask<<11) + 1 ] = 1;

    for ( i=1; i<=br; i++ )
        for ( mask=0; mask<(1<<16); mask++ )
        {
            r = 1; if ( mask&1 ) r = 0;
            for ( j=r; j<=9; j++ )
            {
                if ( j&1 )
                {
                    newMask = mask ^ ( 1 << (j + 1) );
                    if ( !(newMask&1) ) newMask ^= 1;
                    dp[i][mask] += dp[i-1][newMask];
                }
                else
                {
                    int index = 11 + (j>>1);
                    if ( mask&(1<<index) )
                    {
                        newMask = mask ^ ( 1 << (j + 1) );
                        if ( !(newMask&1) ) newMask ^= 1;
                        dp[i][mask] += dp[i-1][newMask];
                    }
                    else
                    {
                        newMask = mask ^ ( 1 << index );
                        if ( !(newMask&1) ) newMask ^= 1;
                        dp[i][mask] += dp[i-1][newMask];
                    }
                }
            }
        }

}

inline int numberOfDigits(const ull &x)
{
    int br=0;
    ull t = x;
    while ( t )
    {
        t/=10;
        br++;
    }
    return br;
}

int a[32];

inline int updateMask(const int &mask,const int &x)
{
    int newMask = mask,index;
    if ( !(newMask&1) ) newMask^=1;
    if ( x&1 )
    {
        newMask ^= ( 1 << (x+1) );
    }
    else
    {
        index = 11 + (x>>1);
        if ( newMask & ( 1 << index ) )
        {
             newMask ^= ( 1 << (x+1) );
        }
        else
        {
            newMask ^= ( 1 << index );
        }
    }
    return newMask;
}

inline ull solve (const ull &x)
{
    if ( x < 2 ) return 0;

    int i,j,d=0,r;

    ull t = x,ans=0;
    while ( t )
    {
        d++;
        a[d] = t%10;
        t/=10;
    }

    for ( i=1; i<d; i++ ) ans+=dp[i][0];

    int currMask=0,nextMask;

    for ( i=1; i<=d; i++ )
    {
        r = 1; if ( currMask&1 ) r = 0;
        for ( j=r; j<a[d+1-i]; j++ )
        {
            nextMask = updateMask (currMask,j);
            ans += dp[d-i][nextMask];
        }

        currMask = updateMask (currMask,a[d+1-i]);
    }

    if ( ( currMask&( (1<<11) - 2 ) ) == 0 ) ans++;

    return ans;
}

int main()
{
    int ka,kb;
    ull a,b;
    scanf ("%llu%llu",&a,&b);

    ka = numberOfDigits (a);
    kb = numberOfDigits (b);
    if ( ka < kb ) generateDP (kb);
    else generateDP (ka);

    printf ("%llu\n", solve(b) - solve(a-1) );
}
