#include <iostream>
#include <string>
using namespace std;

int main()
{
    string N;
    cin >> N;

    if(N.length() == 1)
    {
      cout << 0 << endl;
    }
    else if(N.length() == 2)
    {
        if(N[0] == N[1])
        {
            cout << 0 << endl;
        }
        else
        {
            cout << 1 << endl;
        }
    }
    else if(N.length() == 3)
    {
        if(N[0] == N[1] && N[1] == N[2])
        {
            cout << 0 << endl;
        }
        else if(N[0] == N[1])
        {
            cout << 0 << endl;
        }
        else if(N[1] == N[2] && N[1] != N[0])
        {
            cout << 0 << endl;
        }
        else if(N[1] != N[2] && N[1] != N[0] && N[0] != N[2])
        {
            cout << 1 << endl;
        }
        else if(N[0] == N[2] && N[0] != N[1])
        {
            cout << 1 << endl;
        }
        else
        {
            cout << 1 << endl;
        }
    }
    else if(N.length() >= 4)
    {
        cout << 1 << endl;
    }

    return 0;
}