#include <bits/stdc++.h>
using namespace std;
int N;
int main(void) {
  cin >> N;
  char S[N];
  cin >> S;
  int now = 1;
  int cnt = 0;
  vector<int> V;
  int M[N];
  for (int i = 0; i < N; i++) {
    if (S[i] == '.')
      M[i] = 0;
    else
      M[i] = 1;
  }
  for (int i = 0; i < N; i++) {
    if (M[i] == now) {
      cnt += 1;
    } else {
      V.push_back(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }
  if (cnt != 0) V.push_back(cnt);
  if (M[N - 1] == 0) {
    V.push_back(0);
  }
  long long ans = 0;
  if (V.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= V.size() - 2; i += 2) {
    if (i != V.size() - 2)
      ans += min(V[i], V[i - 1]);
    else if (V[i + 1] == 0)
      ans += V[i];
    else
      ans += min(V[i], V[i - 1]);
  }
  cout << ans << endl;
}
