#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 < n) {
    if (s[pos] == '#') {
      nblack++;
      pos++;
    } else {
      if (nblack == 0) {
        pos++;
        continue;
      }
      long long posf = pos;
      while (s[posf] == '.') {
        nwhite++;
        posf++;
      }
      if (nblack < nwhite) {
        ans += nblack;
        nblack = 0, nwhite = 0;
      } else {
        ans += nwhite;
        nblack += nwhite;
        nwhite = 0;
      }
      pos = posf;
    }
  }
  cout << (ans) << endl;
  return 0;
}
