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 <bits/stdc++.h>
#include <string.h>
#define rep(i, n) for(int i = 0; i<(n); i++)
using namespace std;
typedef long long ll;
//pi = 3.14159265358979323846

int main() {

    int n;
    string s;
    cin >> n >> s;
    int marubatsu;
    marubatsu = 0;

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

}

C++: #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define OUT(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;

    REP(i,s.size()) {
        string ss = s.substr(i,2);
        if (ss == "OX" || ss == "XO") {
            ans++;
            i++;
        }
    }

    cout << ans << endl;

    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n; string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i < n-1; ++i) {
        if(s[i]+s[i+1] == 'O'+'X') {
            ans++;
            s[i] = s[i+1] = '?';
        }
    }
    cout << ans << "\n";
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a=0;
    int d=1;
    int e=2;
    int answer=0;
    cin>>a;
    char b[a];
    int c[a];
    for(int i=1;i<=a;i++){
        cin>>b[i];
    }
    for(int i=1;i<=a;i++){
        if(b[i]=='O'){
            c[i]=1;
        }else{
            c[i]=2;
        }
    }
    while(e<=a){
        if(c[d]==1&&c[e]==2){
            answer++;
            d=d+2;
            e=e+2;
        }else{
            if(c[d]==2&&c[e]==1){
                answer++;
                d=d+2;
                e=e+2;
            }else{
                d++;
                e++;
            }
        }
    }
    cout<<answer<<endl;
}

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


using namespace std;


int main()
{
	int n;
	string str;

	cin >> n;
	cin >> str;

	int count = 0;
	for(int i = 0; i < n ; i++){
		if(i == n - 1)
			break;

		if(str[i] == 'O' && str[i + 1] == 'X'
		|| str[i] == 'X' && str[i + 1] == 'O'){
			count++;
			i++;
		}
	}

	cout << count << endl;

	return 0;
}

C++: #include <iostream>

#define N_MAX 100000 

using namespace std;

int main(void)
{
  int N;
  cin >> N;
  char S[N_MAX];
  for(int i = 0; i < N; i++) cin >> S[i];

  int CC[N_MAX] = {0};
  int num = 0;
  for(int i = 0; i < N-1; i++) {
    if(CC[i] == 0) {
      if(S[i] == 'O' && S[i+1] == 'X') {
	num++;
	CC[i] = 1;
	CC[i+1] = 1;
      }
      if(S[i] == 'X' && S[i+1] == 'O') {
	num++;
	CC[i] = 1;
	CC[i+1] = 1;
      }
    }
  }

  cout << num << endl;

  return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i + 1 >= n) continue;
    string t = "";
    t += s[i], t += s[i + 1];
    if (t == "OX" || t == "XO") {
      ans++;
      i++;
    }
  }
  cout << ans << endl;

  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  string s;cin>>s;
  int ans = 0;
  for(int i = 0; n > i+1; i++){
    if(s[i]!=s[i+1]){
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}

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

int main(){
    int n, i, count;
    string str;
    i = 0;
    count = 0;
    
    cin >> n;
    cin >> str;
    
    while(1){
        if(i >= str.size() - 1) break;
        if((str[i] == 'O' && str[i+1] == 'X') || (str[i] == 'X' && str[i+1] == 'O')){
            count++;
            i += 2;
            continue;
        } 
        else{
            i++;
        }
    }
    
    cout << count << endl;
    
    return 0;
}

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

int main(){
  int N;
  string s;

  cin >> N;
  cin >> s;

  int ans=0;

  for(int i=0;i+1<N;){
    if(s[i]=='O' && s[i+1]=='X'){
      ans++;
      i+=2;
    }
    else if(s[i]=='X' && s[i+1]=='O'){
      ans++;
      i+=2;
    }
    else {
      i++;
    }
  }

  cout << ans << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
//前がxなら１　０なら２　はじめ、もしくは０xがきた後なら３
int main(){
	int n,s=3,ans=0;
	char c;
	cin>>n;
	for(int p=0;p<n;p++){
		cin>>c;
		//cout<<c<<endl;
		if(c=='O'){
			if(s==1){
				ans++;
				s=3;
			}else{
				s=2;
			}
		}else if(c=='X'){
			if(s==2){
				ans++;
				s=3;
			}else{
				s=1;
			}
		}
	}
	cout<<ans<<endl;
}

C++: #include <iostream>

char A[100000 + 10];

int main()
{
  int N;
  std::cin >> N >> A;
  A[N] = 'E';

  int val = 0;
  int cur = 1;
  int ans = 0;
  while (val < N && cur < N)
  {
    while (A[val] == A[cur]) ++cur;
    if (cur < N)
    {
      ++ans;
      val = cur + 1;
      cur = val + 1;
    }
  }

  std::cout << ans << std::endl;  

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)

using namespace std;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    bool flag = false;
    rep(i,n-1) {
        if(s[i] != s[i+1] && (i == 0 || (flag == false))) {
            ans++;
            flag = true;
        } else flag = false;
    }
    cout << ans << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
	int n = 0; string s; cin >> s >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i != s.size() - 1 && s[i] != s[i + 1]) {
			i++; n++;
		}
	}
	cout << n << endl;
}

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	string s;
	cin >> s;
	while (M < N - 1) {
		if (s[M] != s[M + 1]) {
			K++;
			M++;
		}
		M++;
	}
	cout << K << endl;
}