#include <bits/stdc++.h>
int main() {
  int n;
  int kuro = 0, siro = 0, ans, i, p1, p2;
  char s[20002] = "";
  if (scanf("%d ", &n) != 1) return 1;
  if (scanf("%s", s) != 1) return 1;
  for (i = 0; i < n; i++) {
    if (s[i] == '#') {
      kuro++;
    } else if (s[i] == '.') {
      if (kuro) siro++;
    }
  }
  p1 = siro;
  siro = kuro = 0;
  for (i = n - 1; i >= 0; i--) {
    if (s[i] == '#') {
      if (siro) kuro++;
    } else if (s[i] == '.') {
      siro++;
    }
  }
  p2 = kuro;
  if (p1 < p2) {
    ans = p1;
  } else {
    ans = p2;
  }
  printf("%d\n", ans);
  return 0;
}
