#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  int b = 0, w = 0, ans = 0;
  for (int i = 0; i < (n); i++) {
    if (s[i] == '#') {
      if (w) {
        ans += min(b, w);
        b = w = 0;
      }
      b++;
    } else
      w++;
  }
  ans += min(b, w);
  cout << ans << endl;
  return 0;
}
