#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cntdot = 0, cntsh = 0, cntdot2 = 0, cntsh2 = 0, cnt = 0, cnt2;
  cin >> n;
  char s;
  for (int(i) = (0); (i) < (n); i++) {
    cin >> s;
    if (cntsh == 1 && s == '.') cnt++;
    if (cntsh > 1 && cntdot >= 1 && (s != '.' || i == n - 1)) {
      if (i == n - 1 && s == '.') cntdot++;
      cnt += min(cntsh, cntdot);
      cntdot = 0;
      cntsh = 0;
    }
    if (cntsh > 1 && s == '.') {
      cntdot++;
      if (i == n - 1) cnt++;
    } else if (s == '#') {
      cntdot = 0;
      cntsh++;
      cntsh2++;
    } else {
      cntdot = 0;
      cntsh = 0;
    }
    if (s == '.') cntdot2++;
  }
  cnt2 = min(cntdot2, cntsh2);
  cout << min(cnt, cnt2) << endl;
}
