#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
void chmin(T &a, const T &b) noexcept {
  if (b < a) a = b;
}
template <class T>
void chmax(T &a, const T &b) noexcept {
  if (a < b) a = b;
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  string s;
  cin >> n >> s;
  int cntb = 0, cntw = 0, ans = 0;
  auto update = [&]() {
    if (cntb > 0 && cntw > 0) {
      ;
      ans += min(cntb, cntw);
      cntb = 0;
      cntw = 0;
    }
  };
  for (int i = 0; i < (n); ++i) {
    if (cntb == 0 && s[i] == '.') continue;
    int j = i;
    while (j < n) {
      if (s[i] == s[j]) {
        if (s[i] == '#')
          cntb++;
        else
          cntw++;
      } else {
        update();
        break;
      }
      j++;
    }
    i = j - 1;
  }
  update();
  cout << ans << endl;
  return 0;
}
