#include <bits/stdc++.h>
int main(void) {
  int n;
  char s;
  int flag = 0, count1 = 0, count2 = 0, count = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %c", &s);
    if (flag == 0) {
      if (s == '#') {
        flag = 1;
      } else {
      }
    }
    if (flag == 1) {
      if (s == '.') {
        flag = 2;
        printf("f2");
      } else {
        count1++;
      }
    }
    if (flag == 2) {
      if (s == '#') {
        flag = 1;
        count += (count1 < count2 ? count1 : count2);
        count1 = 1;
        count2 = 0;
      } else {
        count2++;
      }
    }
  }
  count += (count1 < count2 ? count1 : count2);
  printf("%d\n", count);
  return 0;
}
