#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  reverse((s).begin(), (s).end());
  int ans = 0;
  for (int i = 0; i < n;) {
    int w = 0;
    int b = 0;
    while (i < n && s[i] == '.') {
      w++;
      i++;
    }
    while (i < n && s[i] == '#') {
      b++;
      i++;
    }
    if (w != 0 && b != 0) ans += min(w, b);
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
