#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MOD = INF + 7;
using P = pair<long long, long long>;
signed main() {
  long long N;
  string S;
  cin >> N >> S;
  long long ans = 0;
  long long b = 0;
  long long w = 0;
  for (long long i = N - 1; i > 0; i--) {
    if (S[i] == '.') {
      w++;
      if (S[i - 1] == '#') {
        long long k = i;
        while (S[k] == '#' && k >= 0) k--;
        b = i - k - 1;
        if (b <= w) {
          k = i;
          while (S[k] == '#' && k >= 0) {
            S[k] == '.';
            k--;
            w++;
            ans++;
          }
        } else
          w = 0;
      }
    }
  }
  for (long long i = 0; i < N - 1; i++) {
    if (S[i] == '#' && S[i + 1] == '.') {
      ans++;
      S[i + 1] = '#';
    }
  }
  cout << ans << endl;
}
