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