#include <bits/stdc++.h>
int main() {
  int n, i, num = 0, c[200005] = {0}, d[200005] = {0};
  scanf("%d", &n);
  getchar();
  char a[200005];
  for (i = 0; i < n; i++) scanf("%c", &a[i]);
  i = 0;
  while (1) {
    int t1 = 0, t2 = 0;
    while (a[i] == '#') {
      t1++;
      i++;
    }
    c[i - 1] = t1;
    int t = i;
    while (a[i] == '.') {
      t2++;
      i++;
    }
    d[t] = t2;
    if (i == n) break;
  }
  for (i = 0; i < n; i++) {
    if (a[i] == '#' && a[i + 1] == '.') {
      if (c[i] <= d[i + 1]) {
        num = num + c[i];
      } else {
        num = num + d[i + 1];
        i = i + d[i + 1];
      }
    }
  }
  printf("%d\n", num);
  return 0;
}
