#include <iostream>

using namespace std;

int main()
{
    int n, p = 0, q = 0;
    cin >> n;
    int c, po0 = -1, po1 = -1;
    int a[10];
    for (int i = 0; n > 0; i++){
        a[i] = n % 10;
        n = n / 10;
        c++;
    }
        for (int j = 0; j < c; j++){
            if (a[j] == 0) po0 = j;
            else po1 = j;
        }
    for (int i = 0; i < po0; i++){
        if (a[i] == 1) q++;
    }
    for (int i = 0; i < po1; i++){
        if (a[i] == 0) p++;
    }
    if ((q == 0) || (p == 0)) cout << 0;
    else if (q < p) cout << q;
    else cout << p;
	return 0;
}