/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
#include <functional>																							   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    string s;
    cin >> s;
    int n = s.size();
    char tab[1000005];
    for(int i = 1; i <= n; i++){
		tab[i] = s[i-1];
	}
   
	int counter_1 = 0;
	int counter_2 = 0;
	
	for(int i = 1; i <= n; i++){
		if(i % 2 == 1){
			if(tab[i] == '0'){
				counter_1++;
			}
		}
		else{
			if(tab[i] == '1'){
				counter_1++;
			}
		}
	}
	
	for(int i = 1; i <= n; i++){
		if(i % 2 == 0){
			if(tab[i] == '0'){
				counter_2++;
			}
		}
		else{
			if(tab[i] == '1'){
				counter_2++;
			}
		}
	}
	
	//cout << "counter1: " << counter_1 << endl;
	//cout << "counter2: " << counter_2 << endl;
	
	cout << min(counter_1, counter_2) << '\n';
    
	return 0;
}


Measured memory_bytes: 592