#include <bits/stdc++.h>
int main(void) {
  int n;
  scanf("%d", &n);
  char s[n];
  scanf("%s", s);
  int a = 0;
  int b = 0;
  int c1 = 0;
  int c2 = 0;
  int d = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#' && b == 0) {
      b = 1;
      c1++;
    } else if (s[i] == '#' && b == 1) {
      c1++;
    } else if (s[i] == '#' && b == 2) {
      if (c1 <= c2) {
        d += c1;
      } else {
        d += c2;
      }
      c1 = 1;
      c2 = 0;
      b = 0;
    } else if (s[i] == '.' && b == 1) {
      c2++;
      b = 2;
    } else if (s[i] == '.' && b == 2) {
      c2++;
    }
  }
  if (b == 2) {
    if (c1 <= c2) {
      d += c1;
    } else {
      d += c2;
    }
  }
  printf("%d\n", d);
  return 0;
}
