#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, ans = 0;
  cin >> n;
  string s;
  cin >> s;
  long long pos = 0, nblack = 0, nwhite = 0;
  while (pos + 1 < n) {
    if (s[pos] == '#' && s[pos + 1] == '.') {
      long long posb = pos, posf = pos;
      while (s[posb] == '#') {
        nblack++;
        posb--;
      }
      while (s[posf + 1] == '.') {
        nwhite++;
        posf++;
      }
      if (nblack >= nwhite) {
        ans += nwhite;
        for (long long i = pos; i <= posf; ++i) s[i] = '#';
      } else {
        ans += nblack;
        for (long long i = posb + 1; i <= pos; ++i) s[i] = '.';
      }
      pos = posf + 1;
      nblack = 0, nwhite = 0;
    } else
      pos++;
  }
  cout << (ans) << endl;
  return 0;
}
