#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int main() {
  int n;
  string s;
  scanf("%d", &n);
  cin >> s;
  int ans = 0, m = 0, i = 0;
  while (i < n) {
    if (s[i] == '#') {
      m++;
      i++;
    } else {
      int k = 0;
      while (i < n && s[i] == '.') k++, i++;
      ans += min(m, k);
      m = 0;
    }
  }
  printf("%d\n", ans);
}
