#include <bits/stdc++.h>
using namespace std;
string s;
long long N;
vector<long long> vec;
long long solve(long long i, long long ans, long long size, long long kuro) {
  if (i >= size - 1) {
    return ans;
  }
  long long tmp1 =
      solve(i + 2, ans + vec[i + 1], size, kuro + vec[i] + vec[i + 1]);
  long long tmp2 = solve(i + 2, ans + vec[i] + kuro, size, 0);
  return min(tmp1, tmp2);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> s;
  char prev = s[0];
  long long len = 1;
  for (long long i = 1; i < N; ++i) {
    if (prev == s[i]) {
      ++len;
    } else {
      prev = s[i];
      vec.push_back(len);
      len = 1;
    }
  }
  vec.push_back(len);
  long long ans = solve(0, 0, vec.size(), 0);
  cout << ans << endl;
}
