#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define PAUSE system("pause");
#define FASTIO                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define FILEIO                     \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
template <typename T>
void read(T &x)
{
    x = 0;
    int flag = 1;
    char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-')
            flag = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        x = x * 10 + c - '0';
        c = getchar();
    }
    x *= flag;
}
const int MOD = 1e9 + 7, INF = 0x3f3f3f3f;

char s[100010]={'\0'};
int main()
{
    int ans1=0,ans2=0;
    cin>>s;
    for(int i=0;s[i]!='\0';i++){
        if(s[i]-'0')ans1++;
        else ans2++;
    }
    cout<<min(ans1,ans2);
    return 0;
}
