#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int cnt1 = 0, cnt2 = 0;
  bool ok1 = true, ok2 = false;
  int ans = 0;
  for (int i = 0; i < (n); ++i) {
    if (ok1) {
      if (s[i] == '#') cnt1++;
      if (cnt1 > 0 && s[i] == '.') {
        ok2 = true;
        ok1 = false;
        cnt2++;
      }
    } else if (ok2) {
      if (s[i] == '.') cnt2++;
      if (s[i] == '#') {
        ans += min(cnt1, cnt2);
        cnt1 = 1;
        cnt2 = 0;
        ok1 = true;
        ok2 = false;
      }
    }
  }
  if (ok2) ans += min(cnt1, cnt2);
  cout << ans << endl;
}
