#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a = 0, b = 0, ans = 0;
  string s;
  char x = 1;
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    if (x && s[i] == '#')
      a++;
    else if (x && s[i] == '.') {
      b = 1;
      x = 0;
    } else if (!x && s[i] == '.')
      b++;
    else if (!x && s[i] == '#') {
      ans += min(a, b);
      a = 1;
      b = 0;
      x = 1;
    }
  }
  if (!x) ans += min(a, b);
  cout << ans << endl;
  return 0;
}
