Go: package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	_, _ = fmt.Scan(&n)
	_, _ = fmt.Scan(&s)
	fmt.Println(calc(s))
}

func calc(s string) int {
	sum := 0
	ss := strings.Split(s,"")
	bf := 0
	for _, v := range ss{
		if bf == 0 {
			bf = cnv(v)
		} else if bf != cnv(v) {
			sum++
			bf = 0
		}
	}
	return sum
}

func cnv(s string) int {
	switch s {
	case "O":
		return 1
	case "X":
		return 2
	}
	return 0
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<bitset>
#include<stack>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;

int dy[8] = { 2,2,-2,-2,1,1,-1,-1 };
int dx[8] = { 1,-1,1,-1,2,-2,2,-2 };



/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
const ll MOD = 998244353;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

// vector
template <typename T>
istream& operator>>(istream & is, vector<T> & vec) { for (T& x : vec) is >> x; return is; }
// pair
template <typename T, typename U>ostream& operator<<(ostream & os, pair<T, U> & pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; }
// vector
template <typename T>ostream& operator<<(ostream & os, const vector<T> & vec) { os << "{";	for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : ", "); }os << "}"; return os; }
// map
template <typename T, typename U>ostream& operator<<(ostream & os, map<T, U> & map_var) { os << "{";	repi(itr, map_var) { os << *itr; itr++; if (itr != map_var.end()) os << ", "; itr--; }os << "}"; return os; }
// set
template <typename T>ostream& operator<<(ostream & os, set<T> & set_var) { os << "{"; repi(itr, set_var) { os << *itr; itr++; if (itr != set_var.end()) os << ", "; itr--; }os << "}"; return os; }



int dp[100005];

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	string S;
	cin >> S;

	dp[0] = 0;
	for (int i = 0; i < N; i++)
	{
		if (i + 1 < N && S[i] != S[i + 1]) {
			dp[i + 2] = max(dp[i + 2], dp[i] + 1);
		}
		else
		{
			dp[i + 1] = max(dp[i + 1], dp[i]);
		}

	}

	cout << dp[N] << endl;






}

C++: #include<bits/stdc++.h>
using namespace std;
using UL=unsigned int;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

int main(){
 UL N; string S; cin>>N>>S;
 UL ans=0;
 for(UL p=0; p<N-1; p++){
  bool ox = false;
  if(S[p]=='X' && S[p+1]=='O') ox=true;
  else if(S[p]=='O' && S[p+1]=='X') ox=true;
  if(ox){ ans++; p++; }
 }
 cout<<ans<<endl;
 return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int i=0,count=0;
    while (i<s.size()-1) {
        if (s.at(i)=='O') {
            if (s.at(i+1)=='X') {
                count++;
                i+=2;
            } else {
                i++;
            }
        } else if (s.at(i)=='X') {
            if (s.at(i+1)=='O') {
                count++;
                i+=2;
            } else {
                i++;
            }
        }
    }
    cout<<count<<endl;
}

C++: #include<cstdio>
using namespace std;
int main()
{
	int n,cnt,i;
	char s[100001];
	scanf("%d",&n);
	scanf("%s",s);
	cnt=0;
	i=0;
	while(i<n-1){
		if(s[i]!=s[i+1]){
			cnt++;
			i++;
		}
		i++;
	}
	printf("%d\n",cnt);
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
	int n,i=0,count=0;
	char S[100000];

	scanf("%d", &n);
	scanf("%s", &S);

	do{
		if (S[i] != S[i + 1] && S[i+1] != NULL) {
			count++;
			i++;
		}
		i++;
	} while (i < n);

	cout << count<<endl;


}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector<char> a(n, ' ');
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	int counter = 0;
	for (int i = 0; i < n-1; i++) {
		if ((a[i] == 'O' && a[i+1] == 'X') || (a[i] == 'X' && a[i+1] == 'O')) {
			counter++;
			i++;
		}
	}
	cout << counter << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	int n,i,ans=0;
	cin >> n;
	string s;
	cin >> s;
	i=0;
	while(i<n-1){
		if(s[i]!=s[i+1]){
			i+=2; ans++;
		}else{
			i++;
		}
		
	}
	cout << ans << endl;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    string s;
    cin>>s;

    int pos=0;
    int ans=0;
    //OXXOX
    while(pos<n-1){
        if( (s[pos]=='O' && s[pos+1]=='X')
        || (s[pos]=='X' && s[pos+1]=='O') ){
            ans++;
            pos+=2;
        }else{
            pos+=1;
        }
    }
    cout << ans << endl;
    return 0;
}

C++: //id:miiifa (AOJ,PEどちらも)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    int n;
    string s;
    cin >> n >> s;
    int cnt=0;
    REP(i,s.size()-1){
        if((s[i]=='O'&&s[i+1]=='X')||(s[i]=='X'&&s[i+1]=='O')){
            cnt++;
            i++;
        }else if(s[i]=='O'||s[i]=='X') {
            
            // if(i==s.size()-2) 
        }
    }
    cout << cnt << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;

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

	string S;
	cin >> S;

	int result = 0;

	for( int i = 0; i < N-1; ) {
		if( S.at( i ) == 'O' && S.at( i+1 ) == 'X' ) {
			result += 1;
			i += 2;
		}
		else if( S.at( i ) == 'X' && S.at( i+1 ) == 'O' ) {
			result += 1;
			i += 2;
		}
		else {
			i += 1;
		}
	}

	cout << result << endl;
}