#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
template <class T>
inline void read(T &res) {
  char c;
  T flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') res = res * 10 + c - '0';
  res *= flag;
}
int n;
char s[N];
int main() {
  read(n);
  int idx = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%c", &s[i]);
    if (s[i] == '#' && !idx) idx = i;
  }
  int num = 0, len1 = 0, len2 = 0, last = 0;
  for (int i = idx; i <= n; i++) {
    if (s[i] == '#' && s[i - 1] == '.') {
      if (len2 < last) {
        last += len2;
        num += len2;
        len2 = 0;
      } else {
        num += last;
        last = len1 = len2 = 0;
      }
      len1 = last = 1;
    }
    if (s[i] == '#') last++, len1++;
    if (s[i] == '.') len2++;
  }
  if (s[n] == '.' && last) num += min(last, len2);
  cout << num << endl;
  return 0;
}
