#include <bits/stdc++.h>
using namespace std;
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
int main() {
  long long N, ans = 0;
  cin >> N;
  char tmp;
  string S;
  cin >> S;
  long long l = 0, r = 0;
  char now;
  for (int i = 0; i < (N); i++) {
    if (S[i] == '#') {
      if (now == '.') {
        ans += min(l, r);
        l = 0;
        r = 0;
      }
      r = 0;
      now = '#';
      l++;
    } else if (S[i] == '.') {
      r++;
      now = '.';
      if (i == N - 1) {
        ans += min(l, r);
      }
    }
  }
  cout << ans;
  return 0;
}
