#include <bits/stdc++.h>
int main(int argc, char *argv[]) {
  int n;
  char s[400000] = {};
  int k = -1;
  int b[400000];
  scanf("%d%s", &n, s);
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      b[j] = i;
      j++;
    }
  }
  int black = j;
  int m = 400000;
  if (j != 0) {
    for (int i = 0; i <= black; i++) {
      if (i + n - black - (b[i] - i) < m) {
        m = i + n - black - (b[i] - i);
      }
    }
  } else {
    m = 0;
  }
  printf("%d\n", m);
  return 0;
}
