#include <bits/stdc++.h>
int main() {
  char s[200000];
  int n, cnt, cnt2, cnt3, i, j, k;
  cnt = 0;
  cnt2 = 0;
  cnt3 = 1;
  int cnt4 = 0;
  scanf("%d", &n);
  scanf("%s", s);
  while (s[n - 1] == '#') n--;
  while (cnt2 < cnt3) {
    cnt2 = 0;
    cnt3 = 0;
    j = n - 1;
    while (s[j] == '.') {
      cnt2++;
      j--;
    }
    k = n - 1 - cnt2;
    while (s[k] == '#') {
      cnt3++;
      k--;
    }
    n = n - (cnt2 + cnt3);
    if (cnt2 < cnt3) cnt4 = cnt4 + cnt2;
  }
  for (i = 0; i < n; i++) {
    if (s[i] == '.') cnt++;
  }
  if (cnt > n / 2) cnt = n - cnt;
  cnt = cnt + cnt4;
  printf("%d", cnt);
  return 0;
}
