#include <iostream> using namespace std; long long a,b; int main () { cin>>a>>b; if(a==b) { if(a/10000000==b%10) { cout<<1; } else { cout<<0; } } else { cout<<3; } return 0; }