/*
* CF.cpp
*
*  Created on: Jan 30, 2015
*      Author: Sohieb Mohamed ( Deader )
*/

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<iterator>
#include<cmath>
#include<string>
#include<sstream>
#include<cstring>
#include<ctype.h>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<fstream>

// Suppress some compilation warning messages
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_SECURE_NO_WARNINGS 1
#define all(v) ((v).begin()),((v).end())

using namespace std;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<string>    vs;
#define INF 1000000000

/*
here you can put your global varibles
*/

char arr[104][104] = { 0 };
int n, m;
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n;i++)
    for (int j = 1; j <= m; j++)
        cin >> arr[i][j];
    char ch = 'W';
    for (int i = 1; i <= n; i++)
    {
        for (int j=1; j <= m; j++)
        {
            if (arr[i][j] == '.')
            {
                if (ch == 'W') {arr[i][j] = 'B'; ch = arr[i][j];}
                else {arr[i][j] = 'W'; ch = arr[i][j];}
                /*if (arr[i - 1][j] != 'B'&&arr[i + i][j] != 'B'&&arr[i][j - 1] != 'B'&&arr[i][j + 1] != 'B')
                    arr[i][j] = 'B';
                else arr[i][j] = 'W';*/
            }
        }
        if (ch == 'B') ch = 'W';
        else ch = 'B';
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cout << arr[i][j];
        cout << endl;
    }
    return 0;
}


/*
* CF.cpp
*
*  Created on: Jan 30, 2015
*      Author: Sohieb Mohamed ( Deader )
*/

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<iterator>
#include<cmath>
#include<string>
#include<sstream>
#include<cstring>
#include<ctype.h>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<fstream>

// Suppress some compilation warning messages
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_SECURE_NO_WARNINGS 1
#define all(v) ((v).begin()),((v).end())

using namespace std;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<string>    vs;
#define INF 1000000000

int n, m;
ss ans = "BW", arr[105];

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        for (int j = 0; j < m; j++)
            if (arr[i][j] == '.') arr[i][j] = ans[(i + j) % 2];
            cout << arr[i] << endl;
    }
}


#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#pragma comment (linker, "/STACK:16777216")

using namespace std;

int com (const void* a, const void* b){
	return *(int *)a - *(int *)b;
}

int main (void){
	//freopen("i.txt","r",stdin);
	//freopen("o.txt", "w+", stdout);

	int n, m;
	char a[110][110];

	scanf("%d%d", &n, &m);

	for(int i=0; i<n; i++) scanf("%s", &a[i]);

	for(int i=0; i<n; i++)
		for(int z=0; z<m; z++)
			if(a[i][z]=='.') { if(a[i][z-1]!='W' && a[i-1][z]!='W') a[i][z]='W'; else a[i][z]='B'; }

	for(int i=0; i<n; i++) { printf("%s\n", a[i]); }
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <set>
#include <iomanip>
#pragma comment (linker, "/STACK:16777216")

using namespace std;

int main (void){
	//freopen("i.txt","r",stdin);
	//freopen("o.txt", "w+", stdout);

}


#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#pragma comment (linker, "/STACK:16777216")

using namespace std;

int com (const void* a, const void* b){
	return *(int *)a - *(int *)b;
}

int main (void){
	//freopen("i.txt","r",stdin);
	//freopen("o.txt", "w+", stdout);

	int n, m;
	char a[110][110];

	scanf("%d%d", &n, &m);

	for(int i=0; i<n; i++) scanf("%s", &a[i]);

	for(int i=0; i<n; i++)
		for(int z=0; z<m; z++)
			if(a[i][z]=='.') { if(abs(i-z)%2) a[i][z]='W'; else a[i][z]='B';}

	for(int i=0; i<n; i++) { printf("%s\n", a[i]); }
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>

using namespace std;

int main()
{
	int n, m;
	string s;
	srand(time(0));
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		for (int j = 0; j < m; j++)
		{
			if (s[j] != '.')
			{
				cout << s[j];
			}
			else if (s[j] == '.' && (j > 0 && s[j - 1] == '-') || (j < m && s[j + 1] == '-'))
			{
				int res = rand() % 2;
				if (res == 1) cout << 'B';
				else cout << 'W';
			}
			else if (s[j] == '.' && !(j > 0 && s[j - 1] == '-') || (j < m && s[j + 1] == '-'))
			{
				if ((i + j) % 2 == 0)
				{
					cout << 'B';
				}
				else
				{
					cout << 'W';
				}
			}
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>

using namespace std;

int main()
{
	int n, m;
	string s;
	srand(time(0));
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		for (int j = 0; j < m; j++)
		{
			if (s[j] != '.')
			{
				cout << s[j];
			}
			else if (s[j] == '.' && ((j > 0 && s[j - 1] == '-') && (j < m && s[j + 1] == '-')))
			{
				int res = rand() % 2;
				if (res == 1) cout << 'B';
				else cout << 'W';
			}
			else if (s[j] == '.' && !((j > 0 && s[j - 1] == '-') || (j < m && s[j + 1] == '-')))
			{
				if ((i + j) % 2 == 0)
				{
					cout << 'B';
				}
				else
				{
					cout << 'W';
				}
			}
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>

using namespace std;

int main()
{
	int n, m;
	string s;
	srand(time(0));
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		for (int j = 0; j < m; j++)
		{
			if (s[j] != '.')
			{
				cout << s[j];
			}
			else if (s[j] == '.' && ((j > 0 && s[j - 1] == '-') || (j < m && s[j + 1] == '-')))
			{
				int res = rand() % 2;
				if (res == 1) cout << 'B';
				else cout << 'W';
			}
			else if (s[j] == '.' && !((j > 0 && s[j - 1] == '-') || (j < m && s[j + 1] == '-')))
			{
				if ((i + j) % 2 == 0)
				{
					cout << 'B';
				}
				else
				{
					cout << 'W';
				}
			}
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>

using namespace std;

int main()
{
	int n, m;
	string s;
	srand(time(0));
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		for (int j = 0; j < m; j++)
		{
			if (s[j] != '.')
			{
				cout << s[j];
			}
			else if (s[j] == '.' && ((j > 0 && s[j - 1] == '-') && (j < m && s[j + 1] == '-')))
			{
				int res = rand() % 2;
				if (res == 1) cout << 'B';
				else cout << 'W';
			}
			else if (s[j] == '.' && !((j > 0 && s[j - 1] == '-') && (j < m && s[j + 1] == '-')))
			{
				if ((i + j) % 2 == 0)
				{
					cout << 'B';
				}
				else
				{
					cout << 'W';
				}
			}
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>

using namespace std;

int main()
{
	int n, m;
	string s;
	srand(time(0));
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		for (int j = 0; j < m; j++)
		{
			if (s[j] != '.')
			{
				cout << s[j];
			}
			else if (s[j] == '.' && ((j > 0 && s[j - 1] == '-') && (j < m && s[j + 1] == '-')))
			{
				int res = rand() % 2;
				if (res == 1) cout << 'B';
				else cout << 'W';
			}
			else if (s[j] == '.')
			{
				if ((i + j) % 2 == 0)
				{
					cout << 'B';
				}
				else
				{
					cout << 'W';
				}
			}
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>

using namespace std;

int main()
{
	int n, m;
	string s;
	srand(time(0));
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> s;
		for (int j = 0; j < m; j++)
		{
			if (s[j] != '.')
			{
				cout << s[j];
			}
			else
			{
				if ((i + j) % 2 == 0)
				{
					cout << 'B';
				}
				else
				{
					cout << 'W';
				}
			}
		}
		cout << endl;
	}
	return 0;
}


#include <stdio.h>

int n, m;
char S[110][110];

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) {
        scanf("%s", S[i]);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (S[i][j] == '-') printf("-");
            else {
                 if( (i+j)%2 == 0) printf("B");
                 else printf("W");
            }
        }
        printf("\n");
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int i, j, n, m;
	char c;
	cin >> n >> m;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			cin >> c;
			if (i & 1)
			{
				if (j & 1)
				{
					if (c != '-'){ c = 'W'; }
				}
				else if (c != '-'){ c = 'B'; }
			}
			else { if (j & 1){ if (c != '-'){ c = 'B'; } } else if (c != '-'){ c = 'W'; } }
			cout << c;
		}
		cout << endl;
	}
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
	typedef string* strings;
	int i, n, m;
	cin >> n >> m;
	strings str = new string[n];
	for (i = 0; i < n; i++)
	{
		cin >> str[i];
		for (int j = 0; j < n; j++)
		{
			if (!(i % 2))
			{
				if (!(j % 2) && str[i][j] != '-'){ str[i][j] = 'W'; }
				else if ((j % 2) && str[i][j] != '-') { str[i][j] = 'B'; }
			}
			else
			{
				if (!(j % 2) && str[i][j] != '-'){ str[i][j] = 'B'; }
				else if ((j % 2) && str[i][j] != '-'){ str[i][j] = 'W'; }
			}
		}
	}
	for (i = 0; i < n; i++)
	{
		cout << str[i] << endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int i, j, n, m;
	char c;
	cin >> n >> m;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			cin >> c;
			if (i & 1)
			{
				if (j & 1)
				{
					if (c != '-'){ c = 'W'; }
				}
				else if (c != '-'){ c = 'B'; }
			}
			else { if (j & 1){ if (c != '-'){ c = 'B'; } } else if (c != '-'){ c = 'W'; } }
			cout << c;
		}
		cout << endl;
	}
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
	typedef string* strings;
	int i, n,m;
	cin >> n>>m;
	strings str = new string[n];
	for (i = 0; i < n; i++)
	{
		cin >> str[i];
	}
	for (i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (!(i % 2))
			{
				if (!(j % 2) && str[i][j] != '-'){ str[i][j] = 'W'; }
				else if ((j % 2) && str[i][j] != '-') { str[i][j] = 'B'; }
			}
			else
			{
				if (!(j % 2) && str[i][j] != '-'){ str[i][j] = 'B'; }
				else if ((j % 2) && str[i][j] != '-'){ str[i][j] = 'W'; }
			}
		}
	}
	for (i = 0; i < n; i++)
	{
		cout << str[i] << endl;
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main()
{
	typedef string* strings;
	int i, n, m;
	cin >> n >> m;
	strings str = new string[n];
	for (i = 0; i < n; i++)
	{
		cin >> str[i];
		for (int j = 0; j < n; j++)
		{
			if (i&1)
			{
				if (j & 1)
				{
					if (str[i][j] != '-'){ str[i][j] = 'W'; }
				}
				else if (str[i][j] != '-'){ str[i][j] = 'B'; }
			}
			else
			{
				if (j & 1)
				{
					if (str[i][j] != '-'){ str[i][j] = 'B'; }

				}
				else if (str[i][j] != '-'){ str[i][j] = 'W'; }
			}
		}
	}
	for (i = 0; i < n; i++)
	{
		cout << str[i] << endl;
	}
	return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n, m, i, j;
    char C[101][101];
    cin >> n >> m;
    for (i = 1; i <= n; i++)
        cin >> *(C+i)+1;
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= m; j++)
        {
            if (C[i][j] == '.')
            {
                if (i % 2)
                    if (j % 2)
                        C[i][j] = 'B';
                    else
                        C[i][j] = 'W';
                else
                    if (j % 2)
                        C[i][j] = 'W';
                    else
                        C[i][j] = 'B';
            }
            cout << C[i][j];
        }
        cout << endl;
    }
    return 0;
}


#include <iostream>
#include <cmath>
#pragma warning(disable:4996)

using namespace std;
void rec(int x, int y, int color);

int dx[4] = { 1, -1, 0, 0 };
int dy[4] = { 0, 0, 1, -1 };
char a[101][101];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= m + 1; j++)
        a[i][j] = '-';

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cin >> a[i][j];
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {

            if (a[i][j] == '.')
            {
                a[i][j] = 'B';
                rec(i, j, 1);
            }
            cout << a[i][j];
        }
        cout << endl;
    }

    return 0;
}

void rec(int x, int y, int color)
{
    for (int i = 0; i <= 3; i++)
    {

        if (a[x + dx[i]][y + dy[i]] == '.')
        {
            a[x + dx[i]][y + dy[i]] = (color == 1) ? 'B' : 'W';
            rec(x + dx[i], y + dy[i], 1 - color);
        }

    }
    return;
}


#include <iostream>
#include <cmath>
#pragma warning(disable:4996)

using namespace std;
void rec(int x, int y, int color);

int dx[4] = { 1, -1, 0, 0 };
int dy[4] = { 0, 0, 1, -1 };
char a[200][200];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= m + 1; j++)
        a[i][j] = '-';

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cin >> a[i][j];
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {

            if (a[i][j] == '.')
            {
                a[i][j] = 'W';
                rec(i, j, 1);
            }
            cout << a[i][j];
        }
        cout << endl;
    }

    return 0;
}

void rec(int x, int y, int color)
{
    for (int i = 0; i <= 3; i++)
    {

        if (a[x + dx[i]][y + dy[i]] == '.')
        {
            a[x + dx[i]][y + dy[i]] = (color == 1) ? 'B' : 'W';
            rec(x + dx[i], y + dy[i], 1 - color);
        }

    }
    return;
}


#include <iostream>
#include <cmath>
#pragma warning(disable:4996)

using namespace std;
void rec(int x, int y, int color);

int dx[4] = { 1, -1, 0, 0 };
int dy[4] = { 0, 0, 1, -1 };
char a[101][101];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= m + 1; j++)
        a[i][j] = '-';

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cin >> a[i][j];
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {

            if (a[i][j] == '.')
            {
                a[i][j] = 'W';
                rec(i, j, 1);
            }
            cout << a[i][j];
        }
        cout << endl;
    }

    return 0;
}

void rec(int x, int y, int color)
{
    for (int i = 0; i <= 3; i++)
    {

        if (a[x + dx[i]][y + dy[i]] == '.')
        {
            a[x + dx[i]][y + dy[i]] = (color == 1) ? 'B' : 'W';
            rec(x + dx[i], y + dy[i], 1 - color);
        }

    }
    return;
}


#include <iostream>
using namespace std;

int n, m;
char a[110][110];
int  main ()
{
	cin >> n >> m;
	for (int i = 0; i<n; i++)
		for (int j = 0; j<m; j++)
			cin >> a[i][j];
	for (int i = 0; i<n; i++)
	{
		for (int j = 0; j<m; j++)
		{
			if(a[i][j] == '.')
				if((i+j) % 2 == 0)
					a[i][j] = 'W';
				else
					a[i][j] = 'B';
			cout << a[i][j];
		}
		cout << endl;
	}
return 0;
}


#include <iostream>
using namespace std;

int n, m;
char a[110][110];
int  main ()
{
	cin >> n >> m;
	for (int i = 0; i<n; i++)
		for (int j = 0; j<m; j++)
			cin >> a[i][j];
	for (int i = 0; i<n; i++)
	{
		for (int j = 0; j<m; j++)
		{
			if(a[i][j] == '.')
				if(i+j % 2 == 0)
					a[i][j] = 'W';
				else
					a[i][j] = 'B';
			cout << a[i][j];
		}
		cout << endl;
	}

return 0;
}


#include<iostream>
#include<vector>
#include<queue>
using namespace std;
char flip(char a){
	if (a == 'B') return 'W';
	return 'B';
}
void dfs(vector<vector<char> > &board, int n, int m , int i, int j, char fill){
	if (i < 0 || i == n || j<0 || j==m||board[i][j]!='.') return;
	board[i][j] = fill;
	fill = flip(fill);
	dfs(board, n, m, i - 1, j, fill); dfs(board, n, m, i + 1, j, fill);
	dfs(board, n, m, i, j - 1, fill); dfs(board, n, m, i, j + 1, fill);
}

void print(vector<vector<char> > &board, int n, int m){
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cout << board[i][j];
		}
		cout << endl;
	}
}

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<char> > board(n, vector<char>(m));
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> board[i][j];
		}
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (board[i][j] == '.'){
				dfs(board, n, m, i, j, 'B');
			}
		}
	}
	print(board, n, m);
	return 0;
}


#include<iostream>
#include<vector>
#include<queue>
using namespace std;
char flip(char a){
	if (a == 'B') return 'W';
	return 'B';
}
void dfs(vector<vector<char> > &board, int n, int m , int i, int j, char fill){
	if (i < 0 || i == n || j<0 || j==m||board[i][j]!='.') return;
	board[i][j] = fill;
	fill = flip(fill);
	dfs(board, n, m, i - 1, j, fill); dfs(board, n, m, i + 1, j, fill);
	dfs(board, n, m, i, j - 1, fill); dfs(board, n, m, i, j + 1, fill);
}

void print(vector<vector<char> > &board, int n, int m){
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cout << board[i][j];
		}
		cout << endl;
	}
}

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<char> > board(n, vector<char>(m));
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> board[i][j];
			if (board[i][j] == '.'){
				if ((i + j) & 1){
					board[i][j] = 'B';
				}
				else board[i][j] = 'W';
			}
		}
	}
	print(board, n, m);
	return 0;
}


#include<iostream>
#include<vector>
#include<queue>
using namespace std;
char flip(char a){
	if (a == 'B') return 'W';
	return 'B';
}
void dfs(vector<vector<char> > &board, int n, int m , int i, int j, char fill){
	if (i < 0 || i == n || j<0 || j==m||board[i][j]!='.') return;
	board[i][j] = fill;
	fill = flip(fill);
	dfs(board, n, m, i - 1, j, fill); dfs(board, n, m, i + 1, j, fill);
	dfs(board, n, m, i, j - 1, fill); dfs(board, n, m, i, j + 1, fill);
}

void print(vector<vector<char> > &board, int n, int m){
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cout << board[i][j];
		}
		cout << endl;
	}
}

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<char> > board(n, vector<char>(m));
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> board[i][j];
			if (board[i][j] == '.'){
				if ((i + j) & 1){
					board[i][j] = 'B';
				}
				else board[i][j] = 'W';
			}
		}
	}
	print(board, n, m);
	return 0;
}


#include<iostream>
#include<vector>
#include<queue>
using namespace std;
char flip(char a){
	if (a == 'B') return 'W';
	return 'B';
}
void dfs(vector<vector<char> > &board, int n, int m , int i, int j, char fill){
	if (i < 0 || i == n || j<0 || j==m||board[i][j]!='.') return;
	board[i][j] = fill;
	fill = flip(fill);
	dfs(board, n, m, i - 1, j, fill); dfs(board, n, m, i + 1, j, fill);
	dfs(board, n, m, i, j - 1, fill); dfs(board, n, m, i, j + 1, fill);
}

void print(vector<vector<char> > &board, int n, int m){
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cout << board[i][j];
		}
		cout << endl;
	}
}

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<char> > board(n, vector<char>(m));
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> board[i][j];
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (board[i][j] == '.'){
				dfs(board, n, m, i, j, 'B');
			}
		}
	}
	print(board, n, m);
	return 0;
}


#include<iostream>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<math.h>
#include <iomanip>
#include<stack>
#include<queue>
#include<iomanip>
#include <sstream>
#include <time.h>

using namespace std;

int main()
{ int  n , m;
char arr[100][100];
cin>>n>>m;
for(int i=0 ;i<n;i++)
{
	for(int j=0;j<m;j++)
	{
		cin>>arr[i][j];
		if(arr[i][j]=='.')
			arr[i][j]='B';
	}
}

for(int i=1; i<m;i++)
{
	if(arr[0][i]!='-')
	{
		if(arr[0][i]==arr[0][i-1] )
		{
			if(arr[0][i]=='B')
				arr[0][i]='W';
			else
				arr[0][i]='B';
		}
	}
}

for(int i=1 ; i<n;i++)
{
	for(int j=0 ; j<m;j++)
	{

		if(arr[i][j]!='-')
		{
			if(arr[i-1][j]==arr[i][j] || arr[i][j-1]==arr[i][j] )
			{
				if(arr[i][j]=='B')
					arr[i][j]='W';
				else
					arr[i][j]='B';

			}
		}

	}
}

for(int i=0 ;i<n;i++)
{
	for(int j=0;j<m;j++)
	{
		cout<<arr[i][j];

	}
	cout<<endl;
}
	return 0;

}


#include<iostream>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<math.h>
#include <iomanip>
#include<stack>
#include<queue>
#include<iomanip>
#include <sstream>
#include <time.h>

using namespace std;

int main()
{ int  n , m;
char arr[100][100];
cin>>n>>m;
for(int i=0 ;i<n;i++)
{
	for(int j=0;j<m;j++)
	{
		cin>>arr[i][j];
		if(arr[i][j]=='.')
			arr[i][j]='B';
	}
}

for(int i=1; i<m;i++)
{
	if(arr[0][i]!='-')
	{
		if(arr[0][i]==arr[0][i-1] )
		{
			if(arr[0][i]=='B')
				arr[0][i]='W';
			else
				arr[0][i]='B';
		}
	}
}

for(int i=1 ; i<n;i++)
{
	for(int j=0 ; j<m;j++)
	{

		if(arr[i][j]!='-')
		{
			if(arr[i-1][j]==arr[i][j] )
			{
				if(arr[i][j]=='B')
					arr[i][j]='W';
				else
					arr[i][j]='B';

			}
			if(j>0)
			{
				if(arr[i][j-1]==arr[i][j] )
				{
					if(arr[i][j]=='B')
					arr[i][j]='W';
					else
					arr[i][j]='B';

				}
			}
		}

	}
}

for(int i=0 ;i<n;i++)
{
	for(int j=0;j<m;j++)
	{
		cout<<arr[i][j];

	}
	cout<<endl;
}
	return 0;

}


#include<iostream>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<math.h>
#include <iomanip>
#include<sstream>
#include <fstream>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;
int main()
{
 int n , m; char arr[100][100];
 cin>>n >>m;
 for(int i=0 ;i<n ;i++)
 {
	for(int j=0 ; j<m ;j++)
	{
		cin>>arr[i][j];
	}
 }

 if( arr[0][0] =='.')
	arr[0][0]='B';

 for(int j=1 ;j<m ;j++)
 {
	 if(arr[0][j]=='.')
	 {
		if(arr[0][j-1]=='B')
			arr[0][j]='W';
		else
			arr[0][j]='B';
	 }
 }

 for(int i=1;i<n ;i++)
 {
	for(int j=0 ; j<m ;j++)
	{
		if(arr[i][j]=='.')
		{
			if(j>0)
			{
				if(arr[i][j-1]!='B' && arr[i-1][j]!='B' )
					arr[i][j]='B';
				else //if(arr[i][j-1]!='W' && arr[i-1][j]!='W' )
					arr[i][j]='W';
			//	else
				//		arr[i][j]='-';
			}
			else
			{
				if(arr[i-1][j]=='B')
					arr[i][j]='W';
				else
					arr[i][j]='B';
			}
		}
	}
 }
  for(int i=0 ;i<n ;i++)
 {
	for(int j=0 ; j<m ;j++)
	{
		cout<<arr[i][j];
	}
	cout<<endl;
 }

	return 0;

}


numInput = int(raw_input())
roachSeq = raw_input().rstrip()
# 1: rbr... 2: brb...
wrongSeq1 = [0,0] # 0: r 1: b
wrongSeq2 = [0,0]

for i in xrange(0,len(roachSeq)):
	if(roachSeq[i] == 'r'):
		wrongSeq1[0] += i%2
		wrongSeq2[0] += (i+1)%2
	else:
		wrongSeq1[1] += (i+1)%2
		wrongSeq2[1] += (i)%2

print(min(max(wrongSeq1),max(wrongSeq2)))


def read(t=None):
	string = raw_input()
	return string if t is None else [t(x) for x in string.split()]

def gor(start):
	while True:
		yield start
		start = ('r' if start == 'b' else 'b')

def sync(a, g):
	d = {'r':0, 'b':0}
	for x in a:
		if x != next(g):
			d[x] += 1
	return min(d['r'], d['b']) + abs(d['r'] - d['b'])

if __name__ == "__main__":
	n = int(read())
	a = list(read())

	x = sync(a, gor('r'))
	y = sync(a, gor('b'))

	print min(x, y)


n, s = 0, []
rs, bs = [], []

def read(t=None):
	string = raw_input()
	return string if t is None else [t(x) for x in string.split()]

def check(src):
	d = {'r': 0, 'b': 0}
	for i in range(n):
		if s[i] != src[i]:
			d[src[i]] += 1
	return min(d['r'], d['b']) + abs(d['r']-d['b'])

if __name__ == "__main__":
	rs = ['r' if i % 2 == 0 else 'b' for i in range(100001)]
	bs = ['b' if i % 2 == 0 else 'r' for i in range(100001)]

	n = int(read())
	s = list(read())

	x = check(rs)
	y = check(bs)

	#print (x, y)
	print min(x, y)


import re
import sys
import time

n = 0
s = []

def read(t=None):
	string = raw_input()
	return string if t is None else [t(x) for x in string.split()]

def compute(s, c):
	x = [s[i] if s[i] != c[i] else 0 for i in range(n)]
	xres = [0, 0]
	for i in x:
		if i == 'r':
			xres[0] += 1
		if i == 'b':
			xres[1] += 1
	x = min(xres) + abs(xres[0]-xres[1])
	return x

def solve():
	global s, n

	n = int(read())
	s = list(read())
	n = len(s)

	r = ['r' if i % 2 == 0 else 'b' for i in range(n)]
	b = ['b' if i % 2 == 0 else 'r' for i in range(n)]

	x = compute(s, r)
	y = compute(s, b)

	#print x, y
	print min(x, y)

if __name__ == "__main__":
	solve()


import sys

n = int(sys.stdin.readline())
s = sys.stdin.readline()[:-1]

# try r as first
red_out_pos = 0
black_out_pos = 0
for i,c in enumerate(s):
  if i % 2 == 0 and c != 'r':
    black_out_pos += 1
  elif i % 2 == 1 and c != 'b':
    red_out_pos += 1

s1 = max(red_out_pos, black_out_pos)

red_out_pos = 0
black_out_pos = 0
for i,c in enumerate(s):
  if i % 2 == 1 and c != 'r':
    black_out_pos += 1
  elif i % 2 == 0 and c != 'b':
    red_out_pos += 1

s2 = max(red_out_pos, black_out_pos)

print min(s1,s2)


n=int(raw_input())
cokroxz=list(raw_input())
a=b=c=d=0
for i in range(len(cokroxz)):
	if i%2==0 and cokroxz[i]=='r':
		a+=1
	elif i%2==1 and cokroxz[i]=='b':
		b+=1
	if i%2==0 and cokroxz[i]=='b':
		c+=1
	elif i%2==1 and cokroxz[i]=='r':
		d+=1
print min(max(a,b),max(c,d))


#!/usr/bin/env python2

n = int(raw_input())
a = raw_input()

rc = a.count("r")
bc = a.count("b")

rr, br, rb, bb = 0, 0, 0, 0
for i in range(n):
  if "rb"[i%2] != a[i]:
    rr += a[i] == 'r'
    br += a[i] == 'b'
  else:
    rb += a[i] == 'r'
    bb += a[i] == 'b'

print(min(max(rr, br), max(rb, bb)))


from collections import defaultdict
def go():
	n = input()
	s = raw_input()

	even={'r':0, 'b':0}
	odd={'r':0, 'b':0}

	for i in range(n):
		if i%2==0:
			even[s[i]]+=1
		else:
			odd[s[i]]+=1
	o = n/2
	e = n-n/2
	# if even is r
	r_even=0
	swaps = min(even['b'],odd['r'])

	r_even+=swaps
	even['r']+=swaps
	odd['b']+=swaps
	r_even+= o-odd['b']
	r_even+= e-even['r']
	b_even=0

	swaps = min(even['r'],odd['b'])
	b_even+=swaps
	odd['r']+=swaps
	even['b']+=swaps
	b_even+=o-odd['r']
	b_even+= e-even['b']

	print max(min(b_even,r_even),0)

go()


from collections import defaultdict
def go():
	n = input()
	s = raw_input()

	even={'r':0, 'b':0}
	odd={'r':0, 'b':0}

	for i in range(n):
		if i%2==0:
			even[s[i]]+=1
		else:
			odd[s[i]]+=1
	o = n/2
	e = n-n/2
	# if even is r
	r_even=0
	swaps = min(even['b'],odd['r'])
	r_even+=swaps
	even['r']+=swaps
	odd['r']-=swaps
	even['b']-=swaps
	odd['b']+=swaps
	r_even+= o-odd['b']
	r_even+= e-even['r']
	b_even=0

	swaps = min(even['r'],odd['b'])
	b_even+=swaps
	even['r']-=swaps
	odd['r']+=swaps
	even['b']+=swaps
	odd['b']-=swaps
	b_even+=o-odd['r']
	b_even+= e-even['b']

	print min(b_even,r_even)

go()


from collections import defaultdict
def go():
	n = input()
	s = raw_input()

	even={'r':0, 'b':0}
	odd={'r':0, 'b':0}

	for i in range(n):
		if i%2==0:
			even[s[i]]+=1
		else:
			odd[s[i]]+=1
	o = n/2
	e = n-n/2
	# if even is r
	r_even=0

	swaps = min(even['b'],odd['r'])
	r_even+=swaps
	even['r']+=swaps
	odd['b']+=swaps

	r_even+= (o-odd['b'])
	r_even+= (e-even['r'])
	even['r']-=swaps
	odd['b']-=swaps
	b_even=0

	swaps = min(even['r'],odd['b'])
	b_even+=swaps
	odd['r']+=swaps
	even['b']+=swaps
	b_even+= o-odd['r']
	b_even+= e-even['b']

	print min(b_even,r_even)

go()


n = input()
s = raw_input()
a, b, c, d = 0, 0, 0, 0
for i in range(0,n,1):
    if i%2 == 0:
        if s[i] == 'r':
            a += 1
        else:
            b += 1
    else:
        if s[i] == 'r':
            c += 1
        else:
            d += 1
print min(max(a, d), max(b, c))


n = int(raw_input())
s = raw_input().strip()
ro, bo, re, be = 0, 0, 0, 0
for i in s[::2]:
    if i == "r":
        re += 1
    else:
        be += 1
for i in s[1::2]:
    if i == "r":
        ro += 1
    else:
        bo += 1
print min(max(re, bo), max(ro, be))


#include <stdio.h>
#include <string.h>
int main()
{
    long int n,i,p;
    int x1=0,x2=0,y1=0,y2=0;
    char s[100010];
    scanf("%ld",&n);
    getchar();
    gets(s);
    p=strlen(s);
    for(i=0;i<p;i+=2)
    {
        if(s[i]=='r')
            x2++;
        else
            x1++;
    }
     for(i=1;i<p;i+=2)
    {
        if(s[i]=='b')
            y2++;
        else
            y1++;
    }
    if(x1<y1)
        x1=y1;
    if(x2<y2)
        x2=y2;
    if(x1>x2)
        x1=x2;
    printf("%d",x1);
        return 0;
}


#include <stdio.h>

#define min(a, b) ((a) < (b) ? (a) : (b))

int main()
{
	const char rb[] = "rb";
	const char br[] = "br";
	int n, i, ans, abr, arb;
	int crb[2] = {0, 0}, cbr[2] = {0, 0};
	char c;

	scanf("%d\n", &n);
	for (i = 0; i < n; i++) {
		c = getchar();
		crb[i & 1] += rb[i & 1] != c;
		cbr[i & 1] += br[i & 1] != c;
	}
	arb = crb[0] + crb[1] - min(crb[0], crb[1]);
	abr = cbr[0] + cbr[1] - min(cbr[0], cbr[1]);
	ans = min(arb, abr);
	printf("%d\n", ans);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(){
	int N;
	scanf("%d ", &N);
	char *s = (char*) malloc(sizeof(char) * (N + 1));
	scanf("%s", s);
	int r[2] = {0}, b[2] = {0},	min[2] = {0}, Nmin = 2147483647;
	char c[2] = {'r', 'b'};
	for(int j = 0, i; j < 2; j++){
		for(i = 0; i < N; i++){
			if(s[i] != c[j]){
				switch(s[i]){
					case 'r':
						r[j]++;
					break;
					case 'b':
						b[j]++;
					break;
				}
			}
			if(c[j] == 'b')
				c[j] = 'r';
			else
				c[j] = 'b';
		}
		min[j] = r[j] > b[j] ? r[j] : b[j];
		//printf("XX%i %i %iXX\n", min[j], r[j], b[j]);
		if(min[j] < Nmin)
			Nmin =	min[j];
	}
	printf("%d\n", Nmin);
}


#include<stdio.h>
int main()
{int n,i,j;int top=1;char d='r';
scanf("%d",&n);
char a[n+1];
scanf("%s",a);
int p=0,q=0,r=0,s=0;int t,u;

for(i=0;i<n;i++)
{if(i%2==0){if(a[i]==d)p++;
else q++;}
else {if(a[i]==d)r++;
else s++;}}
if(s>=p)t=s;
else t=p;
if(q>=r)u=q;
else u=r;

if(t<=u)printf("%d",t);
else printf("%d",u);
return 0;}


#include<stdio.h>
int main()
{int n,i,j;int top=1;
scanf("%d",&n);char a[n];
for(i=0;i<n;i++)scanf("%c",&a[i]);
int r1=0,r2=0,b1=0,b2=0;int min1,min2;
for(i=0;i<n;i++)
{if(i%2==0){if(a[i]=='r')r1++;else b1++;}
else {if(a[i]=='r')r2++;else b2++;}}
if(b2>=r1)min1=b2;
else min1=r1;
if(b1>=r2)min2=b1;
else min2=r2;

printf("%d%d%d%d",r1,r2,b1,b2);
if(min1<=min2)printf("%d",min1);
else printf("%d",min2);
return 0;}


#include<stdio.h>
int main()
{int n,i,j;int top=1;
scanf("%d",&n);char a[n];
for(i=0;i<n;i++)scanf("%c",&a[i]);
int r1=0,r2=0,b1=0,b2=0;int min1,min2;
for(i=0;i<n;i++)
{if(i%2==0){if(a[i]=='r')r1++;else b1++;}
else {if(a[i]=='r')r2++;else b2++;}}
if(b2>=r1)min1=b2;
else min1=r1;
if(b1>=r2)min2=b1;
else min2=r2;

if(min1<=min2)printf("%d",min1);
else printf("%d",min2);
return 0;}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int startWithRR = 0;
	int startWithRB = 0;

	int startWithBR = 0;
	int startWithBB = 0;
	int lengthR = 0;
	int lengthB = 0;
	int length;
	scanf("%d", &length);
	char* colors = malloc(length);
	scanf("%s", colors);
	for(int i = 0; i < length; i++) {
		if(colors[i] == 'r') {
			if(i & 1) {
				if(startWithRB == 0) {
					startWithRR++;
					lengthR++;
				} else {
					startWithRB--;
				}
			} else {
				if(startWithBB == 0) {
					startWithBR++;
					lengthB++;
				} else {
					startWithBB--;
				}
			}
		} else {
			if(i & 1) {
				if(startWithBR == 0) {
					startWithBB++;
					lengthB++;
				} else {
					startWithBR--;
				}
			} else {
				if(startWithRR == 0) {
					startWithRB++;
					lengthR++;
				} else {
					startWithRB--;
				}
			}
		}
	}
	if(lengthB > lengthR) {
		printf("%d\n", lengthR);
	} else {
		printf("%d\n", lengthB);
	}

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int startWithRR = 0;
	int startWithRB = 0;

	int startWithBR = 0;
	int startWithBB = 0;
	int lengthR = 0;
	int lengthB = 0;
	int length;
	scanf("%d", &length);
	char colors[length];
	scanf("%s", &colors);
	for(int i = 0; i < length; i++) {
		if(colors[i] == 'r') {
			if(i & 1) {
				if(startWithRB == 0) {
					startWithRR++;
					lengthR++;
				} else {
					startWithRB--;
				}
			} else {
				if(startWithBB == 0) {
					startWithBR++;
					lengthB++;
				} else {
					startWithBB--;
				}
			}
		} else {
			if(i & 1) {
				if(startWithBR == 0) {
					startWithBB++;
					lengthB++;
				} else {
					startWithBR--;
				}
			} else {
				if(startWithRR == 0) {
					startWithRB++;
					lengthR++;
				} else {
					startWithRR--;
				}
			}
		}
	}
	if(lengthB > lengthR) {
		printf("%d\n", lengthR);
	} else {
		printf("%d\n", lengthB);
	}

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int startWithRR = 0;
	int startWithRB = 0;

	int startWithBR = 0;
	int startWithBB = 0;
	int lengthR = 0;
	int lengthB = 0;
	int length;
	scanf("%d", &length);
	char* colors = malloc(length);
	scanf("%s", colors);
	for(int i = 0; i < length; i++) {
		if(colors[i] == 'r') {
			if(i & 1) {
				if(startWithRB == 0) {
					startWithRR++;
					lengthR++;
				} else {
					startWithRB--;
				}
			} else {
				if(startWithBB == 0) {
					startWithBR++;
					lengthB++;
				} else {
					startWithBB--;
				}
			}
		} else {
			if(i & 1) {
				if(startWithBR == 0) {
					startWithBB++;
					lengthB++;
				} else {
					startWithBR--;
				}
			} else {
				if(startWithRR == 0) {
					startWithRB++;
					lengthR++;
				} else {
					startWithRR--;
				}
			}
		}
	}
	free(colors);
	if(lengthB > lengthR) {
		printf("%d\n", lengthR);
	} else {
		printf("%d\n", lengthB);
	}

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int startWithRR = 0;
	int startWithRB = 0;

	int startWithBR = 0;
	int startWithBB = 0;
	int lengthR = 0;
	int lengthB = 0;
	int length;
	scanf("%d", &length);
	char* colors = malloc(length);
	scanf("%s", colors);
	for(int i = 0; i < length; i++) {
		if(colors[i] == 'r') {
			if(i & 1) {
				if(startWithRB == 0) {
					startWithRR++;
					lengthR++;
				} else {
					startWithRB--;
				}
			} else {
				if(startWithBB == 0) {
					startWithBR++;
					lengthB++;
				} else {
					startWithBB--;
				}
			}
		} else {
			if(i & 1) {
				if(startWithBR == 0) {
					startWithBB++;
					lengthB++;
				} else {
					startWithBR--;
				}
			} else {
				if(startWithRR == 0) {
					startWithRB++;
					lengthR++;
				} else {
					startWithRR--;
				}
			}
		}
	}
	if(lengthB > lengthR) {
		printf("%d\n", lengthR);
	} else {
		printf("%d\n", lengthB);
	}

	return 0;
}


#include <stdio.h>

#define N 100000

int min(int a, int b) {
	return a < b ? a : b;
}

int max(int a, int b) {
	return a > b ? a : b;
}

int main() {
	static char s[N + 1];
	int n, i, kb, kr, k;

	scanf("%d%s", &n, s);
	kb = kr = 0;
	for (i = 0; i < n; i++)
		if (s[i] == 'b')
			kb++;
		else
			kr++;
	k = 0;
	for (i = 0; i < n; i++) {
		char c;

		c = i % 2 == 0 ? (kb > kr ? 'b' : 'r') : (kb > kr ? 'r' : 'b');
		if (s[i] != c) {
			k++;
			s[i] = c;
		}
	}
	printf("%d\n", min(k, max(kb, kr) / 2));
	return 0;
}


#include <stdio.h>

#define N 100000

int min(int a, int b) {
	return a < b ? a : b;
}

int max(int a, int b) {
	return a > b ? a : b;
}

int main() {
	static char s[N + 1], t[N + 1];
	int n, i, j, kb, kr, k;

	scanf("%d%s", &n, s);
	kb = kr = 0;
	for (i = 0; i < n; i++)
		if (s[i] == 'b')
			kb++;
		else
			kr++;
	t[0] = kb > kr ? 'b' : 'r';
	for (i = 1; i < n; i++)
		t[i] = t[i - 1] == 'b' ? 'r' : 'b';
	k = 0;
	for (i = 0; i < n; i++)
		for (j = i + 1; j < n; j++)
			if (s[i] == t[j] && s[j] == t[i] && s[i] != s[j]) {
				char tmp;

				tmp = s[i];
				s[i] = s[j];
				s[j] = tmp;
				k++;
			}
	for (i = 0; i < n; i++)
		if (s[i] != t[i]) {
			k++;
			s[i] = t[i];
		}
	printf("%d\n", min(k, max(kb, kr) / 2));
	return 0;
}


#include <stdio.h>

#define N 100000

int min(int a, int b) { return a < b ? a : b; }

int max(int a, int b) { return a > b ? a : b; }

int main() {
	static char s[N + 1];
	int n, i, kb1, kr1, kb2, kr2;

	scanf("%d%s", &n, s);
	kb1 = kr1 = 0;
	for (i = 0; i < n; i++)
		if (i % 2 == 0 && s[i] != 'b')
			kb1++;
		else if (i % 2 && s[i] != 'r')
			kr1++;
	kr2 = kb2 = 0;
	for (i = 0; i < n; i++)
		if (i % 2 == 0 && s[i] != 'r')
			kr2++;
		else if (i % 2 && s[i] != 'b')
			kb2++;
	printf("%d\n", min(max(kb1, kr1), max(kr2, kb2)));
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

#define N 100000

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	static char s[N + 1];
	int n, i, kb1, kr1, kb2, kr2;

	scanf("%d%s", &n, s);
	kb1 = kr1 = 0;
	for (i = 0; i < n; i++)
		if (i % 2 == 0 && s[i] != 'b')
			kb1++;
		else if (i % 2 && s[i] != 'r')
			kr1++;
	kr2 = kb2 = 0;
	for (i = 0; i < n; i++)
		if (i % 2 == 0 && s[i] != 'r')
			kr2++;
		else if (i % 2 && s[i] != 'b')
			kb2++;
	printf("%d\n", min(min(kb1, kr1) + abs(kb1 - kr1), min(kr2, kb2) + abs(kr2 - kb2)));
	return 0;
}


#include <stdio.h>

#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

int f(char *s, int n, int x, int y) {
    int r = 0;
    int b = 0;

    for (int i = 0; i < n; i++) {
        if (((i & 1) == x) && s[i] == 'r') {
            continue;
        } else if (((i & 1) == y) && s[i] == 'b') {
            continue;
        }

        if (s[i] == 'r') {
            r++;
        } else {
            b++;
        }
    }

    return MAX(r, b);
}

int main(void) {
    int n = 0;
    scanf("%d", &n);

    char s[n + 1];

    scanf("%s", s);

    int a = f(s, n, 0, 1);
    int b = f(s, n, 1, 0);

    printf("%d\n", MIN(a, b));

    return 0;
}


#include <stdio.h>
#include <string.h>
int main ()
{
    long long int n,i,c=0,d=0,j,e=0,f=1;
    scanf ("%I64d",&n);
    getchar();
    char a[n],s;
    gets(a);
    if (a[0]=='r')
        s='b';
        else s='r';
    for (i=1;i<strlen(a);i+=2){
        if (a[i]!=s)
            c++;
            else e++;

            }
            for (j=2;j<strlen(a);j+=2)
            {
                 if (a[j]-a[0])
            d++;
            else f++;

            }
            //printf ("%c",s);
            if (c>d)
                d=c;
            if (e>f)
                f=e;
            if (f<d)
                d=f;
            printf ("%I64d",d);
            return 0;

    }


#include <stdio.h>
#include <string.h>
int main ()
{
    long long int n,i,c=0,d=0,j;
    scanf ("%I64d",&n);
    getchar();
    char a[n],s;
    gets(a);
    if (a[0]=='r')
        s='b';
        else s='r';
    for (i=1;i<strlen(a);i+=2){
        if (a[i]!=s)
            c++;

            }
            for (j=2;j<strlen(a);j+=2)
            {
                 if (a[j]-a[0])
            d++;

            }
            //printf ("%c",s);
            if (c>d)

             printf ("%I64d",c);
             else printf ("%I64d ",d);
        return 0;

    }


#include <stdio.h>
#include <string.h>
int main ()
{
    long long int n,i,c=0,d=0,j,e=1,f=1;
    scanf ("%I64d",&n);
    getchar();
    char a[n],s;
    gets(a);
    if (a[0]=='r')
        s='b';
        else s='r';
    for (i=1;i<strlen(a);i+=2){
        if (a[i]!=s)
            c++;
            else e++;

            }
            for (j=2;j<strlen(a);j+=2)
            {
                 if (a[j]-a[0])
            d++;
            else f++;

            }
            //printf ("%c",s);
            if (c>d)
                d=c;
            if (e>f)
                f=e;
            if (f<d)
                d=f;
            printf ("%I64d",d);
            return 0;

    }


#include <stdio.h>
#include <string.h>
int main ()
{
    long long int n,i,c=0;
    scanf ("%I64d",&n);
    getchar();
    char a[1000020],temp;
    gets(a);
    for (i=1;i<strlen(a)-1;i++)
    {
        if (a[i]==a[i-1])
        {
            if (a[i]==a[i+1])
            {
                if (a[i]=='b')
                    a[i]='r';
                else a[i]='b';
                c++;
            }
            else
            {
                temp=a[i+1];
                a[i+1]=a[i];
                a[i]=temp;
                c++;
            }
        }
    }
        if (strlen(a)>=2){
        if (a[strlen(a)-1]==a[strlen(a)-2])
            c++;
        }
        printf ("%I64d",c);
        //printf (a);
        return 0;

    }


#include <stdio.h>
#include <string.h>
int main ()
{
    long long int n,i,c=0;
    scanf ("%I64d",&n);
    getchar();
    char a[n],temp;
    gets(a);
    for (i=1;i<n-1;i++)
    {
        if (a[i]==a[i-1])
        {
            if (a[i]==a[i+1])
            {
                if (a[i]=='b')
                    a[i]='r';
                else a[i]='b';
                c++;
            }
            else
            {
                temp=a[i+1];
                a[i+1]=a[i];
                a[i]=temp;
                c++;
            }
        }
    }
        if (n>=2){
        if (a[n-1]==a[n-2])
            c++;
        }
        printf ("%I64d",c);
        //printf (a);
        return 0;

    }


#include<stdio.h>
#include<stdlib.h>
int min(int a, int b) {
	if (a<b)
		return a;
	return b;
}
int  main()
{
	int n=0,i=0,r1=0,b1=0,swap1=0,r2=0,b2=0,swap2=0,count=0;
	scanf("%d",&n);
	char a[n];
	for(i=0;i<n;i++)
	{
		scanf("%c",&a[i]);
	}
	for(i=0;i<n;i++)          //if first is red
	{
		if(i%2==1 && a[i]=='r')
		r1++;
		if(i%2==0 && a[i]=='b')
		b1++;
	}
	if(r1==b1)
	swap1=r1;
	else
	swap1=abs(r1-b1)+min(r1,b1);

	for(i=0;i<n;i++)          //if first is blue
	{
		if(i%2==1 && a[i]=='b')
		b2++;
		if(i%2==0 && a[i]=='r')
		r2++;
	}

	if(r2==b2)
	swap2=r2;
	else
	swap2=abs(r2-b2)+min(r2,b2);

	if(swap1>=swap2)
	printf("%d",swap2);
	else
	printf("%d",swap1);

return 0;
}


#include<stdio.h>
#include<stdlib.h>
int min(int a, int b) {
	if (a<b)
		return a;
	return b;
}
int  main()
{
	int n,i,r1,b1,swap1,r2,b2,swap2,count=0;
	scanf("%d",&n);
	char a[n];
	for(i=0;i<n;i++)
	{
		scanf("%c",&a[i]);
	}
	for(i=0;i<n;i++)          //if first is red
	{
		if(i%2==1 && a[i]=='r')
		r1++;
		if(i%2==0 && a[i]=='b')
		b1++;
	}
	if(r1==b1)
	swap1=r1;
	else
	swap1=abs(r1-b1)+min(r1,b1);

	for(i=0;i<n;i++)          //if first is blue
	{
		if(i%2==1 && a[i]=='b')
		b2++;
		if(i%2==0 && a[i]=='r')
		r2++;
	}

	if(r2==b2)
	swap2=r2;
	else
	swap2=abs(r2-b2)+min(r2,b2);

	if(swap1>=swap2)
	printf("%d",swap2);
	else
	printf("%d",swap1);

return 0;
}


#include <stdio.h>

char s[100000];

int main(void) {
	int n,r1,b1,r2,b2,i,ans1,ans2,ans;
	scanf("%d",&n);
	scanf("%s",s);
	char tmp1 = 'r';
	char tmp2 = 'b';
	char x = 'r'^'b';
	//printf("%c ",x^'b');
	r1=b1=r2=b2=0;
	for(i=0;i<n;i++){
	    if(s[i]!=tmp1){
	        if(s[i]=='b') b1++;
	        else r1++;
	    }
	    tmp1^=x;
	    if(s[i]!=tmp2){
	        if(s[i]=='b') b2++;
	        else r2++;
	    }
	    tmp2^=x;
	}
	ans1 = b1>r1?b1:r1;
	ans2 = b2>r2?b2:r2;
	ans = ans1<ans2?ans1:ans2;
	printf("%d",ans);
	return 0;
}


// Copyright lijianhua 2016

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIZE 100001

int abs(int a) {
    if (a>=0) return a;
    else return -a;
}

int main() {
    int n, i;
    char color[SIZE];
    memset(color, 0, sizeof(color));
    scanf("%d", &n);
    int red;
    int black;
    red = 0;
    black = 0;
    int ans1 = 0;
    int ans2 = 0;
    scanf("%s", color);
    for (i = 0; i < n; i++) {
        if (color[i] == 'r' && i%2==0) {
            red++;
        }
        if (color[i] == 'b' && i%2==1) {
            black++;
        }
    }
    ans1 = red > black ? red : black;
    red = 0;
    black = 0;
    for (i = 0; i < n; i++) {
        if (color[i] == 'r' && i%2==1) {
            red++;
        }
        if (color[i] == 'b' && i%2==0) {
            black++;
        }
    }
    ans2 = red > black ? red : black;
    int ans = ans1 > ans2 ? ans2 : ans1;
    printf("%d\n", ans);
    return EXIT_SUCCESS;
}


using System;
     class Program
    {
        static void Main(string[] args)
        {
            int[] cnts;
            {
                string input = Console.In.ReadToEnd().Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)[1];
                cnts = new int[4];
                {
                    bool bf = true;
                    for (int i = 0; i < input.Length; i++, bf=!bf)
                    {
                        if (input[i] == 'r')
                        {
                            if (bf) cnts[0]++;
                            else cnts[1]++;
                        }
                    }
                    cnts[2] = ((input.Length / 2) + (input.Length % 2));
                    cnts[3] = (input.Length - cnts[2] - cnts[1]);
                    cnts[2] -= cnts[0];
                }
            }
            if(cnts[0]>cnts[2])
            {
               if(cnts[1]>cnts[3])
                    cnts[0] = cnts[0] > cnts[1] ? cnts[1] : cnts[0];

               else cnts[0] = Math.Max(cnts[1], cnts[2]);
            }
            else
            {
                if(cnts[3]>cnts[1])
                    cnts[0] = cnts[2] > cnts[3] ? cnts[3] : cnts[2];
                else cnts[0] = Math.Max(cnts[3], cnts[0]);
            }
            Console.WriteLine(cnts[0]);
        }
    }


using System;
using System.Linq;

namespace CSharp
{
    public class _719B
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            Console.WriteLine(Math.Min(
                Math.Max(
                    s.Select((c, i) => new { Color = c, Index = i }).Count(x => x.Color == 'r' && x.Index % 2 == 0),
                    s.Select((c, i) => new { Color = c, Index = i }).Count(x => x.Color == 'b' && x.Index % 2 == 1)),
                Math.Max(
                    s.Select((c, i) => new { Color = c, Index = i }).Count(x => x.Color == 'r' && x.Index % 2 == 1),
                    s.Select((c, i) => new { Color = c, Index = i }).Count(x => x.Color == 'b' && x.Index % 2 == 0))));
        }
    }
}


/* Date: 05.10.2016 * Time: 21:45 */
// *
// ������������ ����� �� ����� 4

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

B. �������� � ��������
����������� �� ������� �� ����
1 �������
����������� �� ������ �� ����
256 ��������
����
����������� ����
�����
����������� �����
��� � ������ ��������, �������� ���� � ���������.
��� ��������, ������ ��������� � ��������� ����� ����� ��������, ��� ���� �������� ������ ���� �����: ������ � �����.
� �������� � ������� ���� n ���������.
������� �������� �������� ���� ��������� � ���� �������.
�������� �� ����� ������� �������������, ������� �� �����, ����� � ������� ����� ��������� ������������.
����� � ���� ���� ����� ������ � ����� ����� ������.
�� ���� ��� �������� ����� ���� �������� ������� ����� ���� ���������, ���� ����������� ������ �� ��������� � ������ ����.
�������� �������� ����������, ����� ����������� ����� ����� ��� ������� �������, ����� ����� ���� ��������� � ������� ������������?
������� ������
� ������ ������ ������� ������ ������ ����� n (1?<=?n?<=?100?000) � ���������� ���������.
�� ������ ������ �������� ������ ����� n, ��������� �� �������� �b� � �r�, ���������� �������������� ������� � ������ ��������.
�������� ������
�������� ���� ����� � ����������� ���������� ��������, ������� ������� ��������� ��������, ����� ����� ��������� � ������� ������������.
�������
������� ������
5
rbbrr
�������� ������
1
������� ������
5
bbbbb
�������� ������
2
������� ������
3
rbr
�������� ������
0
����������
� ������ ������� �������� ������� �������� ������� �������� � ���������� ���������. ��� ����� ��� ����������� ���� ���, ������� ����� 1.
�� ������ ������� ����������� �������� ����� ����������� � ����� ���� ������� � ��������� ���������. �� ��� ����������� 2 ����.
� ������� ������� ����� ��������� � ������� ��� ����������, ������� ����� 0.

*/

using System;
using System.IO;
using System.Globalization;

class Example
{
	public static void Main (string[] args)
	{
# if ( ONLINE_JUDGE )

# else
		StreamReader sr = new StreamReader ("C:\\TRR\\2016\\Task\\07 Codeforces\\020\\B.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2016\\Task\\07 Codeforces\\020\\B.OUT");
# endif

		string ss;

# if ( ONLINE_JUDGE )
		ss = Console.ReadLine ();
		ss = Console.ReadLine ();
# else
		ss = sr.ReadLine ();
		sw.WriteLine (ss);
		ss = sr.ReadLine ();
		sw.WriteLine (ss);
# endif

		int n = ss.Length;
		char [] s = new char [n];
		char [] t = new char [n];
		for ( int i = 0; i < n; i++ )
		{
			s [i] = ss [i];
			t [i] = ss [i];
		}
		int k = 0, m = 0;

		bool ok = true;		// rbrbrb...
		for ( int i = 0; i < n; )
		{
			if ( i < n-1 && ok && t [i] == 'r' && t [i+1] == 'b' )
			{
				i += 2;
			}
			else if ( i < n-1 && ! ok && t [i] == 'b' && t [i+1] == 'r' )
			{
				i += 2;
			}
			else if ( i < n-1 && ok && t [i] == 'b' && t [i+1] == 'r' )
			{
				k ++;
				t [i] = 'r';
				t [i+1] = 'b';
				i += 2;
			}
			else if ( ok && t [i] == 'b' )
			{
				k++;
				t [i] = 'r';
				ok = ! ok;
				i++;
			}
			else if ( i < n-1 && ! ok && t [i] == 'r' && t [i+1] == 'b' )
			{
				k ++;
				t [i] = 'b';
				t [i+1] = 'r';
				i += 2;
			}
			else if ( ! ok && t [i] == 'r' )
			{
				k++;
				t [i] = 'b';
				ok = ! ok;
				i++;
			}
			else
			{
				ok = ! ok;
				i++;
			}
		}

		ok = false;			// brbrbr...
		for ( int i = 0; i < n; )
		{
			if ( i < n-1 && ok && s [i] == 'r' && s [i+1] == 'b' )
			{
				i += 2;
			}
			else if ( i < n-1 && ! ok && s [i] == 'b' && s [i+1] == 'r' )
			{
				i += 2;
			}
			else if ( i < n-1 && ok && s [i] == 'b' && s [i+1] == 'r' )
			{
				m ++;
				s [i] = 'r';
				s [i+1] = 'b';
				i += 2;
			}
			else if ( ok && s [i] == 'b' )
			{
				m++;
				s [i] = 'r';
				ok = ! ok;
				i++;
			}
			else if ( i < n-1 && ! ok && s [i] == 'r' && s [i+1] == 'b' )
			{
				m ++;
				s [i] = 'b';
				s [i+1] = 'r';
				i += 2;
			}
			else if ( ! ok && s [i] == 'r' )
			{
				m ++;
				s [i] = 'b';
				ok = ! ok;
				i++;
			}
			else
			{
				ok = ! ok;
				i++;
			}
		}

# if ( ! ONLINE_JUDGE )
		sw.WriteLine (m + " " + k);
# endif

		if ( m < k )
			k = m;

# if ( ONLINE_JUDGE )
		Console.WriteLine (k);
# else
		sw.WriteLine (k);
# endif

# if ( ! ONLINE_JUDGE )
		sw.Close ();
# endif

	}
}


/* Date: 05.10.2016 * Time: 21:45 */
// *
// ������������ ����� �� ����� 4

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

B. �������� � ��������
����������� �� ������� �� ����
1 �������
����������� �� ������ �� ����
256 ��������
����
����������� ����
�����
����������� �����
��� � ������ ��������, �������� ���� � ���������.
��� ��������, ������ ��������� � ��������� ����� ����� ��������, ��� ���� �������� ������ ���� �����: ������ � �����.
� �������� � ������� ���� n ���������.
������� �������� �������� ���� ��������� � ���� �������.
�������� �� ����� ������� �������������, ������� �� �����, ����� � ������� ����� ��������� ������������.
����� � ���� ���� ����� ������ � ����� ����� ������.
�� ���� ��� �������� ����� ���� �������� ������� ����� ���� ���������, ���� ����������� ������ �� ��������� � ������ ����.
�������� �������� ����������, ����� ����������� ����� ����� ��� ������� �������, ����� ����� ���� ��������� � ������� ������������?
������� ������
� ������ ������ ������� ������ ������ ����� n (1 <= n <= 100,000) � ���������� ���������.
�� ������ ������ �������� ������ ����� n, ��������� �� �������� �b� � �r�, ���������� �������������� ������� � ������ ��������.
�������� ������
�������� ���� ����� � ����������� ���������� ��������, ������� ������� ��������� ��������, ����� ����� ��������� � ������� ������������.
�������
������� ������
5
rbbrr
�������� ������
1
������� ������
5
bbbbb
�������� ������
2
������� ������
3
rbr
�������� ������
0
����������
� ������ ������� �������� ������� �������� ������� �������� � ���������� ���������. ��� ����� ��� ����������� ���� ���, ������� ����� 1.
�� ������ ������� ����������� �������� ����� ����������� � ����� ���� ������� � ��������� ���������. �� ��� ����������� 2 ����.
� ������� ������� ����� ��������� � ������� ��� ����������, ������� ����� 0.

*/

using System;
using System.IO;
using System.Globalization;

class Example
{
	public static void Main (string[] args)
	{
# if ( ONLINE_JUDGE )

# else
		StreamReader sr = new StreamReader ("C:\\TRR\\2016\\Task\\07 Codeforces\\020\\B.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2016\\Task\\07 Codeforces\\020\\B.OUT");
# endif

		string ss;

# if ( ONLINE_JUDGE )
		ss = Console.ReadLine ();
		ss = Console.ReadLine ();
# else
		ss = sr.ReadLine ();
		sw.WriteLine (ss);
		ss = sr.ReadLine ();
		sw.WriteLine (ss);
# endif

		int n = ss.Length;
		char [] s = new char [n];
		char [] t = new char [n];
		for ( int i = 0; i < n; i++ )
		{
			s [i] = ss [i];
			t [i] = ss [i];
		}
		int k = 0, m = 0;

//		bool ok = true;		// rbrbrb...
/*
  		for ( int i = 0; i < n; )
		{
			if ( i < n-1 && ok && t [i] == 'r' && t [i+1] == 'b' )
			{
				i += 2;
			}
			else if ( i < n-1 && ! ok && t [i] == 'b' && t [i+1] == 'r' )
			{
				i += 2;
			}
			else if ( i < n-1 && ok && t [i] == 'b' && t [i+1] == 'r' )
			{
				k ++;
				t [i] = 'r';
				t [i+1] = 'b';
				i += 2;
			}
			else if ( ok && t [i] == 'b' )
			{
				k++;
				t [i] = 'r';
				ok = ! ok;
				i++;
			}
			else if ( i < n-1 && ! ok && t [i] == 'r' && t [i+1] == 'b' )
			{
				k ++;
				t [i] = 'b';
				t [i+1] = 'r';
				i += 2;
			}
			else if ( ! ok && t [i] == 'r' )
			{
				k++;
				t [i] = 'b';
				ok = ! ok;
				i++;
			}
			else
			{
				ok = ! ok;
				i++;
			}
		}

		ok = false;			// brbrbr...
		for ( int i = 0; i < n; )
		{
			if ( i < n-1 && ok && s [i] == 'r' && s [i+1] == 'b' )
			{
				i += 2;
			}
			else if ( i < n-1 && ! ok && s [i] == 'b' && s [i+1] == 'r' )
			{
				i += 2;
			}
			else if ( i < n-1 && ok && s [i] == 'b' && s [i+1] == 'r' )
			{
				m ++;
				s [i] = 'r';
				s [i+1] = 'b';
				i += 2;
			}
			else if ( ok && s [i] == 'b' )
			{
				m++;
				s [i] = 'r';
				ok = ! ok;
				i++;
			}
			else if ( i < n-1 && ! ok && s [i] == 'r' && s [i+1] == 'b' )
			{
				m ++;
				s [i] = 'b';
				s [i+1] = 'r';
				i += 2;
			}
			else if ( ! ok && s [i] == 'r' )
			{
				m ++;
				s [i] = 'b';
				ok = ! ok;
				i++;
			}
			else
			{
				ok = ! ok;
				i++;
			}
		}
*/

		bool ok = true;
		int k1 = 0, k2 = 0;
		for ( int i = 0; i < n; i++, ok = ! ok )
			if ( i % 2 == 1 && s [i] != 'r' )
				k1 ++;
			else if (i % 2 == 0 && s [i] != 'b' )
				k2 ++;

		k = Math.Max (k1, k2);

		ok = false;
		k1 = 0; k2 = 0;
		for ( int i = 0; i < n; i++, ok = ! ok )
			if ( i % 2 == 0 && s [i] != 'r' )
				k1 ++;
			else if (i % 2 == 1 && s [i] != 'b' )
				k2 ++;

		m = Math.Max (k1, k2);

# if ( ! ONLINE_JUDGE )
		sw.WriteLine (m + " " + k);
/*
		for ( int i = 0; i < n; i++ )
			sw.Write (s [i]);
		sw.WriteLine ();
		for ( int i = 0; i < n; i++ )
			sw.Write (t [i]);
		sw.WriteLine ();
*/
# endif

		if ( m < k )
			k = m;

# if ( ONLINE_JUDGE )
		Console.WriteLine (k);
# else
		sw.WriteLine (k);
# endif

# if ( ! ONLINE_JUDGE )
		sw.Close ();
# endif

	}
}

/*
 * const int maxn = 1e5 + 17;
int n, ans = 1e9;
string s, pat;
void go(){
    int x = 0, y = 0;
    for(int i = 0; i < n; i++)
	if(s[i] != pat[i])
	    (i & 1 ? x : y) ++;
    smin(ans, max(x, y));
}
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> s;
    pat.resize(n);
    for(int i = 0; i < n; i ++)  pat[i] = i & 1 ? 'r' : 'b';
    go();
    for(int i = 0; i < n; i ++)  pat[i] = i & 1 ? 'b' : 'r';
    go();
    cout << ans << '\n';
    return 0;
}
*/


/* Date: 05.10.2016 * Time: 21:45 */
// *

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

B. �������� � ��������
����������� �� ������� �� ����
1 �������
����������� �� ������ �� ����
256 ��������
����
����������� ����
�����
����������� �����
��� � ������ ��������, �������� ���� � ���������.
��� ��������, ������ ��������� � ��������� ����� ����� ��������, ��� ���� �������� ������ ���� �����: ������ � �����.
� �������� � ������� ���� n ���������.
������� �������� �������� ���� ��������� � ���� �������.
�������� �� ����� ������� �������������, ������� �� �����, ����� � ������� ����� ��������� ������������.
����� � ���� ���� ����� ������ � ����� ����� ������.
�� ���� ��� �������� ����� ���� �������� ������� ����� ���� ���������, ���� ����������� ������ �� ��������� � ������ ����.
�������� �������� ����������, ����� ����������� ����� ����� ��� ������� �������, ����� ����� ���� ��������� � ������� ������������?
������� ������
� ������ ������ ������� ������ ������ ����� n (1?<=?n?<=?100?000) � ���������� ���������.
�� ������ ������ �������� ������ ����� n, ��������� �� �������� �b� � �r�, ���������� �������������� ������� � ������ ��������.
�������� ������
�������� ���� ����� � ����������� ���������� ��������, ������� ������� ��������� ��������, ����� ����� ��������� � ������� ������������.
�������
������� ������
5
rbbrr
�������� ������
1
������� ������
5
bbbbb
�������� ������
2
������� ������
3
rbr
�������� ������
0
����������
� ������ ������� �������� ������� �������� ������� �������� � ���������� ���������. ��� ����� ��� ����������� ���� ���, ������� ����� 1.
�� ������ ������� ����������� �������� ����� ����������� � ����� ���� ������� � ��������� ���������. �� ��� ����������� 2 ����.
� ������� ������� ����� ��������� � ������� ��� ����������, ������� ����� 0.

*/

using System;
using System.IO;
using System.Globalization;

class Example
{
	public static void Main (string[] args)
	{
# if ( ONLINE_JUDGE )

# else
		StreamReader sr = new StreamReader ("C:\\TRR\\2016\\Task\\07 Codeforces\\020\\B.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2016\\Task\\07 Codeforces\\020\\B.OUT");
# endif

		string ss;

# if ( ONLINE_JUDGE )
		ss = Console.ReadLine ();
		ss = Console.ReadLine ();
# else
		ss = sr.ReadLine ();
		sw.WriteLine (ss);
		ss = sr.ReadLine ();
		sw.WriteLine (ss);
# endif

		int n = ss.Length;
		char [] s = new char [n];
		char [] t = new char [n];
		for ( int i = 0; i < n; i++ )
		{
			s [i] = ss [i];
			t [i] = ss [i];
		}
		int k = 0, m = 0;

		bool ok = true;		// rbrbrb...
		for ( int i = 0; i < n; )
		{
			if ( i < n-1 && ok && t [i] == 'r' && t [i+1] == 'b' )
			{
				i += 2;
			}
			else if ( i < n-1 && ! ok && t [i] == 'b' && t [i+1] == 'r' )
			{
				i += 2;
			}
			else if ( i < n-1 && ok && t [i] == 'b' && t [i+1] == 'r' )
			{
				k ++;
				t [i] = 'r';
				t [i+1] = 'b';
				i += 2;
			}
			else if ( ok && t [i] == 'b' )
			{
				k++;
				t [i] = 'r';
				ok = ! ok;
				i++;
			}
			else if ( i < n-1 && ! ok && t [i] == 'r' && t [i+1] == 'b' )
			{
				k ++;
				t [i] = 'b';
				t [i+1] = 'r';
				i += 2;
			}
			else if ( ! ok && t [i] == 'r' )
			{
				k++;
				t [i] = 'b';
				ok = ! ok;
				i++;
			}
			else
			{
				ok = ! ok;
				i++;
			}
		}

		ok = false;			// brbrbr...
		for ( int i = 0; i < n; )
		{
			if ( i < n-1 && ok && s [i] == 'r' && s [i+1] == 'b' )
			{
				i += 2;
			}
			else if ( i < n-1 && ! ok && s [i] == 'b' && s [i+1] == 'r' )
			{
				i += 2;
			}
			else if ( i < n-1 && ok && s [i] == 'b' && s [i+1] == 'r' )
			{
				m ++;
				s [i] = 'r';
				s [i+1] = 'b';
				i += 2;
			}
			else if ( ok && s [i] == 'b' )
			{
				m++;
				s [i] = 'r';
				ok = ! ok;
				i++;
			}
			else if ( i < n-1 && ! ok && s [i] == 'r' && s [i+1] == 'b' )
			{
				m ++;
				s [i] = 'b';
				s [i+1] = 'r';
				i += 2;
			}
			else if ( ! ok && s [i] == 'r' )
			{
				m ++;
				s [i] = 'b';
				ok = ! ok;
				i++;
			}
			else
			{
				ok = ! ok;
				i++;
			}
		}

# if ( ! ONLINE_JUDGE )
		sw.WriteLine (m + " " + k);
# endif

		if ( m < k )
			k = m;

# if ( ONLINE_JUDGE )
		Console.WriteLine (k);
# else
		sw.WriteLine (k);
# endif

# if ( ! ONLINE_JUDGE )
		sw.Close ();
# endif

	}
}


#define CodeForces
//#define DEBUG

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CodingChallenge
{
	// Test
	public class Program
	{

#if CodeForces
		private static object solve()
		{
			int n = Read<int>();
			char[] roaches = Read<string>().ToCharArray();
			int[] ca = 2.Times(x => 0).ToArray();
			int[] cb = 2.Times(x => 0).ToArray();
			string a = "rb";
			for (int i = 0; i < roaches.Length; i++)
			{
				if (roaches[i] == a[i % 2])
				{
					cb[i % 2]++;
				}
				else
				{
					ca[i % 2]++;
				}
			}
			return Math.Min(ca[0] + ca[1] - Math.Min(ca[0],ca[1]), cb[0] + cb[1] - Math.Min(cb[0],cb[1]));
		}
#endif

#if GoogleCodeJam
		private static string solveCase()
		{
			return "";
		}
#endif

		private static Queue<string> testqueue = new Queue<string>(@"

5
rbbrr

".Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));

// *********************** HERE BE BOILERPLATE *********************** //

#region input
		private static void Read<T>(out T t)
		{
			t = Read<T>();
		}

		private static void Read<T, S>(out T t, out S s)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
		}

		private static void Read<T, S, R>(out T t, out S s, out R r)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
			r = (R)Convert.ChangeType(vals[2], typeof(R));
		}

		private static void Read<T, S, R, A>(out T t, out S s, out R r, out A a)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
			r = (R)Convert.ChangeType(vals[2], typeof(R));
			a = (A)Convert.ChangeType(vals[3], typeof(A));
		}

		private static void Read<T, S, R, A, B>(out T t, out S s, out R r, out A a, out B b)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
			r = (R)Convert.ChangeType(vals[2], typeof(R));
			a = (A)Convert.ChangeType(vals[3], typeof(A));
			b = (B)Convert.ChangeType(vals[4], typeof(B));
		}

		private static T Read<T>()
		{
			return (T)Convert.ChangeType(Read(), typeof(T));
		}

		private static T[] ReadMany<T>(char[] sep = null)
		{
			return Read<string>().Split(sep ?? new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
				.Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();
		}

		private static T[][] ReadField<T>(int len, char[] sep = null)
		{
			T[][] result = new T[len][];
			for (int i = 0; i < len; i++)
			{
				result[i] = ReadMany<T>(sep);
			}
			return result;
		}
#endregion

#region dynamic programming
		private static Func<A, B> DP<A, B>(Func<A, Func<A, B>, B> f)
		{
			Dictionary<A, B> cache = new Dictionary<A, B>();
			Func<A, B> res = null;
			res = a =>
			{
				if (!cache.ContainsKey(a))
					cache.Add(a, f(a, res));
				return cache[a];
			};
			return res;
		}

		private static Func<A, B, C> DP<A, B, C>(Func<A, B, Func<A, B, C>, C> f)
		{
			Dictionary<Tuple<A, B>, C> cache = new Dictionary<Tuple<A, B>, C>();
			Func<A, B, C> res = null;
			res = (a, b) =>
			{
				Tuple<A, B> t = Tuple.Create(a, b);
				if (!cache.ContainsKey(t))
					cache.Add(t, f(a, b, res));
				return cache[t];
			};
			return res;
		}

		private static Func<A, B, C, D> DP<A, B, C, D>(Func<A, B, C, Func<A, B, C, D>, D> f)
		{
			Dictionary<Tuple<A, B, C>, D> cache = new Dictionary<Tuple<A, B, C>, D>();
			Func<A, B, C, D> res = null;
			res = (a, b, c) =>
			{
				Tuple<A, B, C> t = Tuple.Create(a, b, c);
				if (!cache.ContainsKey(t))
					cache.Add(t, f(a, b, c, res));
				return cache[t];
			};
			return res;
		}

		private static Func<A, B, C, D, E> DP<A, B, C, D, E>(Func<A, B, C, D, Func<A, B, C, D, E>, E> f)
		{
			Dictionary<Tuple<A, B, C, D>, E> cache = new Dictionary<Tuple<A, B, C, D>, E>();
			Func<A, B, C, D, E> res = null;
			res = (a, b, c, d) =>
			{
				Tuple<A, B, C, D> t = Tuple.Create(a, b, c, d);
				if (!cache.ContainsKey(t))
					cache.Add(t, f(a, b, c, d, res));
				return cache[t];
			};
			return res;
		}
#endregion

#region utils

		private static IEnumerable<int> Range(int start, int stop, int step)
		{
			for (int l = start; start <= stop; l+=step)
				yield return l;
		}

		private static IEnumerable<long> Range(long start, long stop, long step)
		{
			for (long l = start; start <= stop; l+=step)
				yield return l;
		}

		public static T[][] NewArray<T>(int x, int y)
		{
			T[][] res = new T[x][];
			for (int i = 0; i < x; i++)
				res[i] = new T[y];
			return res;
		}

		public static T[][][] NewArray<T>(int x, int y, int z)
		{
			T[][][] res = new T[x][][];
			for (int i = 0; i < x; i++)
			{
				res[i] = new T[y][];
				for (int j = 0; j < y; j++)
					res[i][j] = new T[z];
			}
			return res;
		}

#endregion

#if GoogleCodeJam
		private static StreamReader inf;
		private static StreamReader outf;

		private delegate void o(string format, params object[] args);
		private static o Output;

		private static void Init()
		{
			const string downloads = "/home/ben/downloads/";
			Console.Write($"Download folder prefix: {downloads}\nEnter file to read from: ");
			StreamReader inf = new StreamReader(Console.ReadLine());
			Console.Write("Enter file to write to (in current directory): ");
			StreamWriter outf = new StreamWriter(Console.ReadLine());
			Output += highlightedPrinting;
#if !DEBUG
			Output += outf.WriteLine;
#endif
		}

		private static void highlightedPrinting(string format, params object[] args)
		{
			ConsoleColor c = Console.ForegroundColor;
			Console.ForegroundColor = ConsoleColor.Green;
			Console.WriteLine(format, args);
			Console.ForegroundColor = prev;
		}

		public static void Main(string[] args)
		{
			Init();
			int n = Read<int>();
			for (int i = 1; i <= n; i++)
				Output($"Case #{i}: {solveCase()}");
			inf.Close();
			outf.Close();
			Console.ForegroundColor = ConsoleColor.Red;
			Console.WriteLine("Done!");
		}

		private static string Read()
		{
#if DEBUG
			return testqueue.Dequeue();
#else
			return inf.ReadLine();
#endif
		}
#endif

#if CodeForces
		private static string show(object o)
		{
			IEnumerable e = o as IEnumerable;
			if (e != null && !(e is string))
			{
				// Don't do this with nested arrays
				return string.Join(" ", e.OfType<object>().Select(show));
			}
			else if (o is double)
			{
				return ((double)o).ToString("0.000000000", CultureInfo.InvariantCulture);
			}
			else if (o is decimal)
			{
				return ((decimal)o).ToString("0.000000000", CultureInfo.InvariantCulture);
			}
			else
			{
				return o.ToString();
			}
		}

		public static void Main(string[] args)
		{
#if DEBUG
			Stopwatch sw = new Stopwatch();
			sw.Start();
#endif
			object res = solve();
			string s = show(res);
			if (!string.IsNullOrEmpty(s))
				Console.WriteLine(s);
#if DEBUG
			sw.Stop();
			Console.WriteLine(sw.Elapsed);
#endif
		}

		private static string Read()
		{
#if DEBUG
			return testqueue.Dequeue();
#else
			return Console.ReadLine();
#endif
		}
#endif
	}

	static class Extensions
	{
		public static IEnumerable<T> Times<T>(this int n, Func<T> f)
		{
			for (int i = 0; i < n; i++)
				yield return f();
		}

		public static IEnumerable<T> Times<T>(this int n, Func<int, T> f)
		{
			for (int i = 0; i < n; i++)
				yield return f(i);
		}

#region binary search (SearchBinary)

		public static int SearchBinary<T>(this IList<T> array, T elem, bool highest = false) where T : IComparable<T>
		{
			return array.SearchBinary(elem, 0, array.Count - 1, highest);
		}

		public static int SearchBinary<T>(this IList<T> array, T elem, int low, int high, bool getHighest) where T : IComparable<T>
		{
			while (low <= high) {
				int m = (low + high) / 2;
				if (elem.Equals(array[m]))
				{
					while (m >= 0 && m < array.Count && elem.Equals(array[m])) m += getHighest ? 1 : -1;
					return m;
				}
				if (elem.CompareTo(array[m]) < 0) high = m - 1;
				else low = m + 1;
			}
			return -1;
		}

		public static int SearchBinary<T>(this Func<int, T> map, T elem, int low, int high, bool highest = false) where T : IComparable<T>
		{
			while (low <= high)
			{
				int m = (low + high) / 2;
				T k = map(m);
				if (elem.Equals(k))
				{
					// use pre-in/decrement because of oder of operations
					while (elem.Equals(k)) k = map(highest ? ++m : --m);
					return m;
				}
				if (elem.CompareTo(k) < 0) high = m - 1;
				else low = m + 1;
			}
			return int.MinValue;
		}

#endregion

#region cartesian product

		public static IEnumerable<C> Cartesian<A, B, C>(this IEnumerable<A> a, IEnumerable<B> b, Func<A, B, C> f)
		{
			return a.SelectMany(aa => b.Select(bb => f(aa, bb)));
		}

		public static IEnumerable<Tuple<A, B>> Cartesian<A, B>(this IEnumerable<A> a, IEnumerable<B> b)
		{
			return a.Cartesian(b, Tuple.Create);
		}

		public static IEnumerable<Tuple<A, B, C>> Cartesian<A, B, C>(this IEnumerable<Tuple<A, B>> ab, IEnumerable<C> c)
		{
			return ab.Cartesian(c, (t, cc) => Tuple.Create(t.Item1, t.Item2, cc));
		}

		public static IEnumerable<Tuple<A, B, C, D>> Cartesian<A, B, C, D>(this IEnumerable<Tuple<A, B, C>> abc, IEnumerable<D> d)
		{
			return abc.Cartesian(d, (t, dd) => Tuple.Create(t.Item1, t.Item2, t.Item3, dd));
		}

		public static IEnumerable<Tuple<A, B, C, D, E>> Cartesian<A, B, C, D, E>(this IEnumerable<Tuple<A, B, C, D>> abcd, IEnumerable<E> e)
		{
			return abcd.Cartesian(e, (t, ee) => Tuple.Create(t.Item1, t.Item2, t.Item3, t.Item4, ee));
		}

#endregion

#region haskell list funcs

		// Haskell's sequence
		public static IEnumerable<IEnumerable<T>> Sequence<T>(this IEnumerable<IEnumerable<T>> seq)
		{
			IEnumerable<T>[] arr = seq as IEnumerable<T>[] ?? seq.ToArray();
			IEnumerable<IEnumerable<T>> res = arr.First().Select(Pure);
			foreach (IEnumerable<T> sequence in seq.Skip(1))
			{
				res = res.Cartesian(sequence, (cur, s) => cur.Concat(Pure(s)));
			}
			return res;
		}

		// Haskell's replicateM (generate all words from an alphabet)
		public static IEnumerable<IEnumerable<T>> ReplicateM<T>(this IEnumerable<T> en, int num)
		{
			return Enumerable.Repeat(en, num).Sequence();
		}

		public static IEnumerable<T> Demask<T>(this IEnumerable<Tuple<T, bool>> en)
		{
			return en.Where(t => t.Item2).Select(t => t.Item1);
		}

		public static IEnumerable<IEnumerable<T>> Powerset<T>(IEnumerable<T> en)
		{
			T[] inp = en.ToArray();
			foreach (IEnumerable<bool> config in new[] { true, false }.ReplicateM(inp.Length))
			{
				yield return inp.Zip(config, Tuple.Create).Demask();
			}
		}

#endregion

#region utils

		private static IEnumerable<T> Pure<T>(T item)
		{
			yield return item;
		}

		private static T Id<T>(T t)
		{
			return t;
		}

#endregion

#region reshaping
		public static T[][] Reshape<T>(this IEnumerable<T> seq, int x, int y)
		{
			int i = 0, j = 0;
			T[][] res = Program.NewArray<T>(x, y);
			while (true) {
				foreach(T item in seq) {
					res[i][j] = item;
					j++;
					if (j == y) {
						i++;
						j = 0;
						if (i == x)
							break;
					}
				}
				if (i == x)
					break;
			}
			return res;
		}

		public static T[][][] Reshape<T>(this IEnumerable<T> seq, int x, int y, int z)
		{
			int i = 0, j = 0, k = 0;
			T[][][] res = Program.NewArray<T>(x, y, z);
			while (true) {
				foreach(T item in seq) {
					res[i][j][k] = item;
					k++;
					if (k == z) {
						j++;
						k = 0;
						if (j == y) {
							i++;
							j = 0;
							if (i == x)
								break;
						}
					}
				}
				if (i == x)
					break;
			}
			return res;
		}
#endregion

	}
}


#define CodeForces
#define DEBUG

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CodingChallenge
{
	// Test
	public class Program
	{

#if CodeForces
		private static object solve()
		{
			int n = Read<int>();
			char[] roaches = Read<string>().ToCharArray();
			int[] ca = 2.Times(x => 0).ToArray();
			int[] cb = 2.Times(x => 0).ToArray();
			string a = "rb";
			for (int i = 0; i < roaches.Length; i++)
			{
				if (roaches[i] == a[i % 2])
				{
					cb[i % 2]++;
				}
				else
				{
					ca[i % 2]++;
				}
			}
			return Math.Min(ca[0] + ca[1] - Math.Min(ca[0],ca[1]), cb[0] + cb[1] - Math.Min(cb[0],cb[1]));
		}
#endif

#if GoogleCodeJam
		private static string solveCase()
		{
			return "";
		}
#endif

		private static Queue<string> testqueue = new Queue<string>(@"

5
rbbrr

".Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));

// *********************** HERE BE BOILERPLATE *********************** //

#region input
		private static void Read<T>(out T t)
		{
			t = Read<T>();
		}

		private static void Read<T, S>(out T t, out S s)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
		}

		private static void Read<T, S, R>(out T t, out S s, out R r)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
			r = (R)Convert.ChangeType(vals[2], typeof(R));
		}

		private static void Read<T, S, R, A>(out T t, out S s, out R r, out A a)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
			r = (R)Convert.ChangeType(vals[2], typeof(R));
			a = (A)Convert.ChangeType(vals[3], typeof(A));
		}

		private static void Read<T, S, R, A, B>(out T t, out S s, out R r, out A a, out B b)
		{
			string[] vals = ReadMany<string>();
			t = (T)Convert.ChangeType(vals[0], typeof(T));
			s = (S)Convert.ChangeType(vals[1], typeof(S));
			r = (R)Convert.ChangeType(vals[2], typeof(R));
			a = (A)Convert.ChangeType(vals[3], typeof(A));
			b = (B)Convert.ChangeType(vals[4], typeof(B));
		}

		private static T Read<T>()
		{
			return (T)Convert.ChangeType(Read(), typeof(T));
		}

		private static T[] ReadMany<T>(char[] sep = null)
		{
			return Read<string>().Split(sep ?? new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
				.Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();
		}

		private static T[][] ReadField<T>(int len, char[] sep = null)
		{
			T[][] result = new T[len][];
			for (int i = 0; i < len; i++)
			{
				result[i] = ReadMany<T>(sep);
			}
			return result;
		}
#endregion

#region dynamic programming
		private static Func<A, B> DP<A, B>(Func<A, Func<A, B>, B> f)
		{
			Dictionary<A, B> cache = new Dictionary<A, B>();
			Func<A, B> res = null;
			res = a =>
			{
				if (!cache.ContainsKey(a))
					cache.Add(a, f(a, res));
				return cache[a];
			};
			return res;
		}

		private static Func<A, B, C> DP<A, B, C>(Func<A, B, Func<A, B, C>, C> f)
		{
			Dictionary<Tuple<A, B>, C> cache = new Dictionary<Tuple<A, B>, C>();
			Func<A, B, C> res = null;
			res = (a, b) =>
			{
				Tuple<A, B> t = Tuple.Create(a, b);
				if (!cache.ContainsKey(t))
					cache.Add(t, f(a, b, res));
				return cache[t];
			};
			return res;
		}

		private static Func<A, B, C, D> DP<A, B, C, D>(Func<A, B, C, Func<A, B, C, D>, D> f)
		{
			Dictionary<Tuple<A, B, C>, D> cache = new Dictionary<Tuple<A, B, C>, D>();
			Func<A, B, C, D> res = null;
			res = (a, b, c) =>
			{
				Tuple<A, B, C> t = Tuple.Create(a, b, c);
				if (!cache.ContainsKey(t))
					cache.Add(t, f(a, b, c, res));
				return cache[t];
			};
			return res;
		}

		private static Func<A, B, C, D, E> DP<A, B, C, D, E>(Func<A, B, C, D, Func<A, B, C, D, E>, E> f)
		{
			Dictionary<Tuple<A, B, C, D>, E> cache = new Dictionary<Tuple<A, B, C, D>, E>();
			Func<A, B, C, D, E> res = null;
			res = (a, b, c, d) =>
			{
				Tuple<A, B, C, D> t = Tuple.Create(a, b, c, d);
				if (!cache.ContainsKey(t))
					cache.Add(t, f(a, b, c, d, res));
				return cache[t];
			};
			return res;
		}
#endregion

#region utils

		private static IEnumerable<int> Range(int start, int stop, int step)
		{
			for (int l = start; start <= stop; l+=step)
				yield return l;
		}

		private static IEnumerable<long> Range(long start, long stop, long step)
		{
			for (long l = start; start <= stop; l+=step)
				yield return l;
		}

		public static T[][] NewArray<T>(int x, int y)
		{
			T[][] res = new T[x][];
			for (int i = 0; i < x; i++)
				res[i] = new T[y];
			return res;
		}

		public static T[][][] NewArray<T>(int x, int y, int z)
		{
			T[][][] res = new T[x][][];
			for (int i = 0; i < x; i++)
			{
				res[i] = new T[y][];
				for (int j = 0; j < y; j++)
					res[i][j] = new T[z];
			}
			return res;
		}

#endregion

#if GoogleCodeJam
		private static StreamReader inf;
		private static StreamReader outf;

		private delegate void o(string format, params object[] args);
		private static o Output;

		private static void Init()
		{
			const string downloads = "/home/ben/downloads/";
			Console.Write($"Download folder prefix: {downloads}\nEnter file to read from: ");
			StreamReader inf = new StreamReader(Console.ReadLine());
			Console.Write("Enter file to write to (in current directory): ");
			StreamWriter outf = new StreamWriter(Console.ReadLine());
			Output += highlightedPrinting;
#if !DEBUG
			Output += outf.WriteLine;
#endif
		}

		private static void highlightedPrinting(string format, params object[] args)
		{
			ConsoleColor c = Console.ForegroundColor;
			Console.ForegroundColor = ConsoleColor.Green;
			Console.WriteLine(format, args);
			Console.ForegroundColor = prev;
		}

		public static void Main(string[] args)
		{
			Init();
			int n = Read<int>();
			for (int i = 1; i <= n; i++)
				Output($"Case #{i}: {solveCase()}");
			inf.Close();
			outf.Close();
			Console.ForegroundColor = ConsoleColor.Red;
			Console.WriteLine("Done!");
		}

		private static string Read()
		{
#if DEBUG
			return testqueue.Dequeue();
#else
			return inf.ReadLine();
#endif
		}
#endif

#if CodeForces
		private static string show(object o)
		{
			IEnumerable e = o as IEnumerable;
			if (e != null && !(e is string))
			{
				// Don't do this with nested arrays
				return string.Join(" ", e.OfType<object>().Select(show));
			}
			else if (o is double)
			{
				return ((double)o).ToString("0.000000000", CultureInfo.InvariantCulture);
			}
			else if (o is decimal)
			{
				return ((decimal)o).ToString("0.000000000", CultureInfo.InvariantCulture);
			}
			else
			{
				return o.ToString();
			}
		}

		public static void Main(string[] args)
		{
#if DEBUG
			Stopwatch sw = new Stopwatch();
			sw.Start();
#endif
			object res = solve();
			string s = show(res);
			if (!string.IsNullOrEmpty(s))
				Console.WriteLine(s);
#if DEBUG
			sw.Stop();
			Console.WriteLine(sw.Elapsed);
#endif
		}

		private static string Read()
		{
#if DEBUG
			return testqueue.Dequeue();
#else
			return Console.ReadLine();
#endif
		}
#endif
	}

	static class Extensions
	{
		public static IEnumerable<T> Times<T>(this int n, Func<T> f)
		{
			for (int i = 0; i < n; i++)
				yield return f();
		}

		public static IEnumerable<T> Times<T>(this int n, Func<int, T> f)
		{
			for (int i = 0; i < n; i++)
				yield return f(i);
		}

#region binary search (SearchBinary)

		public static int SearchBinary<T>(this IList<T> array, T elem, bool highest = false) where T : IComparable<T>
		{
			return array.SearchBinary(elem, 0, array.Count - 1, highest);
		}

		public static int SearchBinary<T>(this IList<T> array, T elem, int low, int high, bool getHighest) where T : IComparable<T>
		{
			while (low <= high) {
				int m = (low + high) / 2;
				if (elem.Equals(array[m]))
				{
					while (m >= 0 && m < array.Count && elem.Equals(array[m])) m += getHighest ? 1 : -1;
					return m;
				}
				if (elem.CompareTo(array[m]) < 0) high = m - 1;
				else low = m + 1;
			}
			return -1;
		}

		public static int SearchBinary<T>(this Func<int, T> map, T elem, int low, int high, bool highest = false) where T : IComparable<T>
		{
			while (low <= high)
			{
				int m = (low + high) / 2;
				T k = map(m);
				if (elem.Equals(k))
				{
					// use pre-in/decrement because of oder of operations
					while (elem.Equals(k)) k = map(highest ? ++m : --m);
					return m;
				}
				if (elem.CompareTo(k) < 0) high = m - 1;
				else low = m + 1;
			}
			return int.MinValue;
		}

#endregion

#region cartesian product

		public static IEnumerable<C> Cartesian<A, B, C>(this IEnumerable<A> a, IEnumerable<B> b, Func<A, B, C> f)
		{
			return a.SelectMany(aa => b.Select(bb => f(aa, bb)));
		}

		public static IEnumerable<Tuple<A, B>> Cartesian<A, B>(this IEnumerable<A> a, IEnumerable<B> b)
		{
			return a.Cartesian(b, Tuple.Create);
		}

		public static IEnumerable<Tuple<A, B, C>> Cartesian<A, B, C>(this IEnumerable<Tuple<A, B>> ab, IEnumerable<C> c)
		{
			return ab.Cartesian(c, (t, cc) => Tuple.Create(t.Item1, t.Item2, cc));
		}

		public static IEnumerable<Tuple<A, B, C, D>> Cartesian<A, B, C, D>(this IEnumerable<Tuple<A, B, C>> abc, IEnumerable<D> d)
		{
			return abc.Cartesian(d, (t, dd) => Tuple.Create(t.Item1, t.Item2, t.Item3, dd));
		}

		public static IEnumerable<Tuple<A, B, C, D, E>> Cartesian<A, B, C, D, E>(this IEnumerable<Tuple<A, B, C, D>> abcd, IEnumerable<E> e)
		{
			return abcd.Cartesian(e, (t, ee) => Tuple.Create(t.Item1, t.Item2, t.Item3, t.Item4, ee));
		}

#endregion

#region haskell list funcs

		// Haskell's sequence
		public static IEnumerable<IEnumerable<T>> Sequence<T>(this IEnumerable<IEnumerable<T>> seq)
		{
			IEnumerable<T>[] arr = seq as IEnumerable<T>[] ?? seq.ToArray();
			IEnumerable<IEnumerable<T>> res = arr.First().Select(Pure);
			foreach (IEnumerable<T> sequence in seq.Skip(1))
			{
				res = res.Cartesian(sequence, (cur, s) => cur.Concat(Pure(s)));
			}
			return res;
		}

		// Haskell's replicateM (generate all words from an alphabet)
		public static IEnumerable<IEnumerable<T>> ReplicateM<T>(this IEnumerable<T> en, int num)
		{
			return Enumerable.Repeat(en, num).Sequence();
		}

		public static IEnumerable<T> Demask<T>(this IEnumerable<Tuple<T, bool>> en)
		{
			return en.Where(t => t.Item2).Select(t => t.Item1);
		}

		public static IEnumerable<IEnumerable<T>> Powerset<T>(IEnumerable<T> en)
		{
			T[] inp = en.ToArray();
			foreach (IEnumerable<bool> config in new[] { true, false }.ReplicateM(inp.Length))
			{
				yield return inp.Zip(config, Tuple.Create).Demask();
			}
		}

#endregion

#region utils

		private static IEnumerable<T> Pure<T>(T item)
		{
			yield return item;
		}

		private static T Id<T>(T t)
		{
			return t;
		}

#endregion

#region reshaping
		public static T[][] Reshape<T>(this IEnumerable<T> seq, int x, int y)
		{
			int i = 0, j = 0;
			T[][] res = Program.NewArray<T>(x, y);
			while (true) {
				foreach(T item in seq) {
					res[i][j] = item;
					j++;
					if (j == y) {
						i++;
						j = 0;
						if (i == x)
							break;
					}
				}
				if (i == x)
					break;
			}
			return res;
		}

		public static T[][][] Reshape<T>(this IEnumerable<T> seq, int x, int y, int z)
		{
			int i = 0, j = 0, k = 0;
			T[][][] res = Program.NewArray<T>(x, y, z);
			while (true) {
				foreach(T item in seq) {
					res[i][j][k] = item;
					k++;
					if (k == z) {
						j++;
						k = 0;
						if (j == y) {
							i++;
							j = 0;
							if (i == x)
								break;
						}
					}
				}
				if (i == x)
					break;
			}
			return res;
		}
#endregion

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            int count = 0;

            int countR = 0;
            int countB = 0;
            int memoR = 0;
            int memoB = 0;

            char current = 'b';
            for(int i =1; i<s.Length; i++)
            {
                if(i == s.Length -1)
                {
                    memoB += countB / 2;
                    memoR += countR / 2;
                }

                if (s[i] == 'b')
                {
                    if (s[i] == current)
                    {
                        countB++;
                        //if (i == s.Length - 1)
                        //{
                        //    memoB += countB / 2;
                        //}
                    }
                    else
                    {

                        memoB += countB / 2;
                        current = s[i];
                        countB = 1;
                    }
                }
                else
                {
                    if (s[i] == current)
                    {
                        countR++;
                        //if (i == s.Length - 1)
                        //{
                        //    memoR += countR / 2;
                        //}
                    }
                    else
                    {

                        memoR += countR / 2;
                        current = s[i];
                        countR = 1;
                    }
                }
            }

            count = memoB + memoR;
            if (memoB <= memoR)
            {
                count -= memoB;
            }
            else
            {
                count -= memoR;
            }

            Console.WriteLine(count);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            char[] s2 = new char[s.Length];
            s.CopyTo(s2,0);
            int count = 0;

            int countR = 0;
            int countB = 0;
            int memoR = 0;
            int memoB = 0;

            //int tmpCount = 1;
            char current = 'b';
            for(int i =1; i<s.Length; i++)
            {
                if (s[i] == 'b')
                {
                    if (s[i] == current)
                    {
                        countB++;
                        if (i == s.Length - 1)
                        {
                            memoB += countB / 2;
                        }
                    }
                    else
                    {

                        memoB += countB / 2;
                        current = s[i];
                        countB = 1;
                    }
                }
                else
                {
                    if (s[i] == current)
                    {
                        countR++;
                        if (i == s.Length - 1)
                        {
                            memoR += countR / 2;
                        }
                    }
                    else
                    {

                        memoR += countR / 2;
                        current = s[i];
                        countR = 1;
                    }
                }
            }

            count = memoB + memoR;
            if (memoB <= memoR)
            {
                count -= memoB;
            }
            else
            {
                count -= memoR;
            }

            Console.WriteLine(count);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            int count = 0;

            int countR = 0;
            int countB = 0;
            int memoR = 0;
            int memoB = 0;

            char current = 'b';
            for(int i =0; i<s.Length; i++)
            {
                if(i == s.Length -1)
                {
                    memoB += countB / 2;
                    memoR += countR / 2;
                }

                if (s[i] == 'b')
                {
                    if (s[i] == current)
                    {
                        countB++;
                    }
                    else
                    {

                        memoB += countB / 2;
                        current = s[i];
                        countB = 1;
                    }
                }
                else
                {
                    if (s[i] == current)
                    {
                        countR++;
                    }
                    else
                    {

                        memoR += countR / 2;
                        current = s[i];
                        countR = 1;
                    }
                }
            }

            count = memoB + memoR;
            if (memoB <= memoR)
            {
                count -= memoB;
            }
            else
            {
                count -= memoR;
            }

            Console.WriteLine(count);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();

            int countR = 0;
            int countB = 0;
            int countR2 = 0;
            int countB2 = 0;

            for(int i =0; i<s.Length; i++)
            {

                if (i % 2 == 0)
                {
                    if (s[i] == 'b') countB++;
                    else countR2++;

                }
                else
                {

                    if (s[i] == 'b') countB2++;
                    else countR++;

                }

            }

            int memo1 = Math.Max(countB,countR);
            int memo2 = Math.Max(countB2,countR2);

            Console.WriteLine(Math.Min(memo1,memo2));
		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            int count = 0;

            int countR = 0;
            int countB = 0;
            int memoR = 0;
            int memoB = 0;

            char current = 'b';
            for(int i =0; i<s.Length; i++)
            {

                if (s[i] == 'b')
                {
                    if (s[i] == current)
                    {
                        countB++;
                    }
                    else
                    {

                        memoB += countB / 2;
                        current = s[i];
                        countB = 1;
                    }
                }
                else
                {
                    if (s[i] == current)
                    {
                        countR++;
                    }
                    else
                    {

                        memoR += countR / 2;
                        current = s[i];
                        countR = 1;
                    }
                }

				if(i == s.Length -1)
                {
                    memoB += countB / 2;
                    memoR += countR / 2;
                }
            }

            count = memoB + memoR;
            if (memoB <= memoR)
            {
                count -= memoB;
            }
            else
            {
                count -= memoR;
            }

            Console.WriteLine(count);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            char[] s2 = new char[s.Length];
            s.CopyTo(s2,0);
            int count = 0;

            int countR = 0;
            int countB = 0;

            for(int i = 1;  i<s.Length; i++)
            {
                if (s[i] == s[i - 1])
                {
                    if (s[i] == 'b')
                    {
                        countB++;
                        s[i]='r';
                    }
                    else
                    {
                        countR++;
                        s[i] = 'b';
                    }

                }

            }

            int countR2 = 0;
            int countB2 = 0;
            int countAnother = 0;

            for (int i = 0; i < s2.Length-1; i++)
            {
                if (s2[i] == s2[i + 1])
                {
                    if (s2[i] == 'b')
                    {
                        countB2++;
                        s2[i] = 'r';
                    }
                    else
                    {
                        countR2++;
                        s2[i] = 'b';
                    }

                }

            }
            countAnother = countB2 + countR2;
            if (countB2 <= countR2)
            {
                countAnother -= countB2;
            }
            else
            {
                countAnother -= countR2;
            }

            count = countB + countR;
            if(countB<=countR)
            {
                count -= countB;
            }
            else
            {
                count -= countR;
            }

            Console.WriteLine(count<countAnother? count : countAnother);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            char[] s2 = new char[s.Length];
            s.CopyTo(s2,0);

            int countR = 0;
            int countB = 0;
            int countR2 = 0;
            int countB2 = 0;

            for(int i =0; i<s.Length; i++)
            {

                if (s[i] == 'b')
                {
                    if (i%2 == 0)
                    {
                        countB++;
                    }
                    else
                    {

                        countB2++;

                    }
                }
                else
                {
                    if (i % 2 == 0)
                    {
                        countR++;
                    }
                    else
                    {

                        countR2++;

                    }
                }

            }

            int memo1 = Math.Max(countB,countR);
            int memo2 = Math.Max(countR,countR2);
		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            int count = 0;

            int countR = 0;
            int countB = 0;

            for(int i = 1;  i<s.Length; i++)
            {
                if (s[i] == s[i - 1])
                {
                    if (s[i] == 'b')
                    {
                        countB++;
                        s[i]='r';
                    }
                    else
                    {
                        countR++;
                        s[i] = 'b';
                    }

                }

            }

            count = countB + countR;
            if(countB<=countR)
            {
                count -= countB;
            }
            else
            {
                count -= countR;
            }

            Console.WriteLine(count);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

            var num = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToArray();
            int count = 0;

            int countR = 0;
            int countB = 0;
            int memoR = 0;
            int memoB = 0;

            char current = 'b';
            for(int i =0; i<s.Length; i++)
            {

                if(i == s.Length -1)
                {
                    memoB += countB / 2;
                    memoR += countR / 2;
                }

                if (s[i] == 'b')
                {
                    if (s[i] == current)
                    {
                        countB++;
                    }
                    else
                    {

                        memoB += countB / 2;
                        current = s[i];
                        countB = 1;
                    }
                }
                else
                {
                    if (s[i] == current)
                    {
                        countR++;
                    }
                    else
                    {

                        memoR += countR / 2;
                        current = s[i];
                        countR = 1;
                    }
                }
            }

            count = memoB + memoR;
            if (memoB <= memoR)
            {
                count -= memoB;
            }
            else
            {
                count -= memoR;
            }

            Console.WriteLine(count);

		}

	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF373_B
{
    class Program
    {
        static int oddb, evenb, oddr, evenr;
        static void Main(string[] args)
        {
            int n = scan[0];
            var s = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                if((i+1) % 2 == 0)
                {
                    if (s[i] == 'b') evenb++;
                    else evenr++;
                }
                else
                {
                    if (s[i] == 'b') oddb++;
                    else oddr++;
                }
            }
            //Console.WriteLine(oddb+" "+evenb+" "+oddr+" "+evenr);
            if (Math.Abs(oddb - evenr) == 1 && evenb == 0 && oddr == 0) Console.WriteLine(0);
            else if (Math.Abs(oddr - evenb) == 1 && evenr == 0 && oddb == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                int min = int.MaxValue;

                min = Math.Min(min, evenb + oddr);
                min = Math.Min(min, evenr + oddb);
                min = Math.Min(min, Math.Min(evenb, oddr) + Math.Abs(evenb - oddr));
                min = Math.Min(min, Math.Min(evenr, oddb) + Math.Abs(evenr - oddb));
                Console.WriteLine(min);
           }
        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}