#include <bits/stdc++.h>
char S[2 * 100001] = {0};
int main() {
  int N;
  int i = 0;
  int black = 0, white = 0;
  int ans = 0;
  scanf("%d", &N);
  scanf("%s", S);
  for (i = (N - 1); 0 <= i; i--) {
    if (S[i] == '#') {
      black++;
    } else {
      white++;
      if (black != 0) {
        if (white > black) {
          ans += black;
        } else {
          ans += white;
        }
        black = 0;
        white = 0;
      }
    }
  }
  if (white > black) {
    ans += black;
  } else {
    ans += white;
  }
  printf("%d\n", ans);
  return 0;
}
