#include <bits/stdc++.h>
char s[2 * 100000];
unsigned long int N;
unsigned long int befor_sharp(unsigned int pos) {
  unsigned int count = 1;
  for (int i = pos - 1; i >= 0; i--) {
    if (s[i] == '#') {
      count++;
    } else {
      break;
    }
  }
  return count;
}
unsigned long int after_sharp(unsigned int pos) {
  unsigned int count = 0;
  for (unsigned int i = pos + 1; i < N; i++) {
    if (s[i] == '.') {
      count++;
    } else {
      break;
    }
  }
  return count;
}
int main() {
  scanf("%ld", &N);
  scanf("%s", s);
  unsigned long int sh_count = 0;
  long int count = 0;
  for (unsigned long int i = 0; i < N - 1; i++) {
    if ((s[i] == '#') && (s[i + 1] == '.')) {
      count++;
      if (i == 0) {
        s[i] = '.';
      } else if (s[i - 1] == '.') {
        s[i] = '.';
      } else {
        unsigned int cl = 0;
        for (unsigned int j = i + 1; j < N; j++) {
          if (s[j] == '.') {
            cl++;
          } else {
            break;
          }
        }
        if (sh_count < cl) {
          count += (sh_count);
          s[i] = '.';
        } else {
          s[i + 1] = '#';
        }
      }
    }
    if (s[i] == '#') {
      sh_count++;
    } else {
      sh_count = 0;
    }
  }
  printf("%ld\n", count);
  return 0;
}
