#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cont = 0, dot = 0, bk = 0;
  string s;
  scanf("%d", &n);
  cin >> s;
  if (s[0] == '.')
    dot++;
  else
    bk++;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == '.')
      dot++;
    else
      bk++;
    if (s[i] == '.' && s[i - 1] == '#') {
      cont += min(dot, bk);
      dot = 0, bk = 0;
    }
  }
  printf("%d\n", cont);
  return 0;
}
