#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int Count(char c1, char c2)
{
if(c1 >= 'A' && c1 <='Z') c1 -= 'A' - 'a';
if(c2 >= 'A' && c2 <='Z') c2 -= 'A' - 'a';
if(abs(c1 - c2) <= 1) return 0;
else return c1 - c2 - 1;
}
int main()
{
Faster;
char a, b; cin >> a >> b;
cout << Count(a,b);
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBlbCAiXG4iCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxvbmcgbG9uZwojZGVmaW5lIHNlIHNlY29uZAojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgYmUgYmVnaW4oKQojZGVmaW5lIGVuIGVuZCgpCiNkZWZpbmUgRmFzdGVyIGNpbi50aWUoMCk7IGNvdXQudGllKDApOyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwoKaW50IENvdW50KGNoYXIgYzEsIGNoYXIgYzIpCnsKICAgIGlmKGMxID49ICdBJyAmJiBjMSA8PSdaJykgYzEgLT0gJ0EnIC0gJ2EnOwogICAgaWYoYzIgPj0gJ0EnICYmIGMyIDw9J1onKSBjMiAtPSAnQScgLSAnYSc7CiAgICBpZihhYnMoYzEgLSBjMikgPD0gMSkgcmV0dXJuIDA7CiAgICBlbHNlIHJldHVybiBjMSAtIGMyIC0gMTsKfQppbnQgbWFpbigpCnsKICAgIEZhc3RlcjsKICAgIGNoYXIgYSwgYjsgY2luID4+IGEgPj4gYjsKICAgIGNvdXQgPDwgQ291bnQoYSxiKTsKICAgIHJldHVybiAwOwp9Cg==