#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  string before, after;
  int res = 100000;
  cin >> n;
  cin >> before;
  after = before;
  sort((after).begin(), (after).end());
  for (int i = (0); i < ((n + 1)); ++i) {
    int tmp = 0;
    for (int j = (0); j < ((n)); ++j) {
      if (before[j] != after[j]) ++tmp;
    }
    res = min(res, tmp);
    rotate(after.begin(), after.begin() + 1, after.end());
  }
  cout << res / 2;
}
