Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	s, _ := nextString()
	return strconv.Atoi(s)
}

func nextString() (string, bool) {
	succeeded := scanner.Scan()
	if succeeded {
		return scanner.Text(), succeeded
	}
	return "", succeeded
}

func printArr(arr []string) {
	fmt.Println(strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]"))
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n, _ := nextInt()
	if n == 1 {
		fmt.Println(0)
		return
	}

	s, succeeded := nextString()
	if !succeeded {
		fmt.Errorf("Scan failed")
		return
	}
	nOX := 0
	i := 1
	for {
		if s[i] != s[i-1] {
			nOX++
			i++
		}
		i++
		if i >= n {
			break
		}
	}
	fmt.Println(nOX)
}

C++: #include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

  int n;

  vector<char> s;

  cin >> n;

  string tmp = "abc";
  cin >> tmp;

  for(int i = 0; i < n; i++){
    char tmp_2 = tmp[i];
    s.push_back(tmp_2);
    
  }
  /*
  for(int i = 0; i < s.size(); i++){
    cout << s[i] << " ";
  }
  cout << "\n";
  */
  int cnt1 = 0;
  int cnt2 = 0;
  
  for(int i = 0; i < n-1; i++){
    if((s[i] == 'O' && s[i+1] == 'X') || (s[i] == 'X' && s[i+1] == 'O')){
      cnt1++;
      i++;
    }
  }for(int i = 0; i < n; i++){
    if((s[n-i-1] == 'O' && s[n-i-1-1] == 'X') || (s[n-i-1] == 'X' && s[n-i-1-1] == 'O')){
      cnt2++;
      i++;
    }
  }

  cout << max(cnt1, cnt2) << '\n';
  
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll i;
    ll ans = 0;
    for(i = 0; i < n;){
        if(i < n - 1 &&
           (s.substr(i, 2) == "OX" || s.substr(i, 2) == "XO")){
            ans++;
            i += 2;
        }else{
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}

C++: #include "iostream"
#include "string"
#include "algorithm"
using namespace std;

int main() {
	int n;
	cin >> n;
	string str;
	cin >> str;
	int ans = 0;
	for (int i = 0; i < n-1; i++) {
		if (str[i] != str[i + 1]) {
			ans++;
			i++;
		}
	}
	cout << ans << endl;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

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

C++: #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0;
  for(int i = 0;i < n;i++){
    if(i + 1 < n && s[i] != s[i+1]){
      cnt++;
      i++;
    }
  }
  cout << cnt << endl;
}

C++: #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int cnt = 0;
    for (int i = 0; i + 1 < n; i++) {
        if (s[i] != s[i + 1]) cnt++, i++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

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

using namespace std;

int main(){
	ll n, z, i;
	string s;
	
	cin>>n;
	cin>>s;
	
	z=0;
	for(i=0; i<n-1; i++){
		if(s[i]=='O' && s[i+1]=='X') z++, i++;
			else if(s[i]=='X' && s[i+1]=='O') z++, i++;
	}
	
	cout<<z<<endl;
}

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

int main()
{
	string str;
	int n;

	cin >> n;
	cin >> str;

	int m = 0;
	for (int i = 0; i < n; i++) {
		if ((str[i] == 'O') && (str[i + 1] == 'X')) {
			m++;
			i++;
		}
		else if ((str[i]=='X')&&(str[i+1]=='O'))
		{
			m++;
			i++;
		}
	}
	cout << m << endl;

	return 0;
}

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

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

    char* retu = new char[nagasa+1];
    cin >> retu;

    int flag = 2;
    int mResult = 0;

    for (int i = 0; i < nagasa; i++) {

        if (retu[i] == 'O') {
            if (flag == 1) {
                ++mResult;
                flag = 2;
            }
            else {
                flag = 0;
            }
        }
        if (retu[i] == 'X') {
            if (flag == 0) {
                ++mResult;
                flag = 2;
            }
            else {
                flag = 1;
            }
        }
    }

    cout << mResult <<endl;

    delete[] retu;
    return 0;
}

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

int N;
string S;

int main(){
	cin >> N >> S;
	int ans = 0;
	for(int i = 0; i < N-1; i++){
		char now = S[i];
		char nxt = S[i+1];
		if(now != nxt){
			ans++;
			i++;
		}
	}
	cout << ans << endl;

	return 0;
}