#include <bits/stdc++.h>
int MIN(int a, int b) { return a < b ? a : b; }
int compare(const void *a, const void *b) {
  if (*(int *)a > *(int *)b) return 1;
  return -1;
}
int main() {
  int n, b[200001] = {0}, i, w[200001] = {0};
  scanf("%d", &n);
  char s[n + 1];
  int chk = 0;
  scanf("%s", s);
  for (i = 0; i < n; i++) {
    if (s[i] == '.') {
      chk++;
    }
  }
  if (chk == 0 || chk == n) {
    printf("0");
    return 0;
  }
  if (s[0] == '#') {
    w[0] = chk;
    b[0] = 1;
  } else {
    w[0] = chk - 1;
  }
  for (i = 1; i < n; i++) {
    if (s[i] == '#') {
      b[i] = b[i - 1] + 1;
      w[i] = w[i - 1];
    } else {
      b[i] = b[i - 1];
      w[i] = w[i - 1] - 1;
    }
  }
  int x;
  int ans[200001] = {0};
  for (i = 0; i < n; i++) {
    if (b[i] == i + 1 && w[i] == n - (i + 1)) {
      x = chk;
    }
    ans[i] = b[i] + w[i];
  }
  qsort(ans, n, sizeof(int), compare);
  printf("%d", MIN(ans[0], x));
  return 0;
}
