#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
int tab[200010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<pair<int, int> > q;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char ta;
    cin >> ta;
    if (ta == '.')
      tab[i] = 0;
    else
      tab[i] = 1;
  }
  int now = tab[1];
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (tab[i] != now) {
      q.push_back(make_pair(now, cnt));
      now = tab[i];
      cnt = 1;
    } else
      ++cnt;
  }
  q.push_back(make_pair(now, cnt));
  int ans = 0;
  for (int i = 0; i + 1 < q.size(); i++) {
    if (q[i].first == q[i + 1].first) {
      q[i + 1].second += q[i].second;
      continue;
    }
    if (q[i].first == 0) continue;
    if (q[i].second < q[i + 1].second) {
      ans += q[i].second;
      q[i].first ^= 1;
    } else {
      ans += q[i + 1].second;
      q[i + 1].first ^= 1;
    }
  }
  cout << ans << endl;
}
