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