#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int tmp0 = 0;
  int tmp1 = 0;
  int time = 0;
  bool flag0 = true;
  for (int i = 0; i < N; ++i) {
    if (S[i] == '#' && S[i - 1] == '.') {
      time += min(tmp0, tmp1);
      tmp0 = 0;
      tmp1 = 0;
      flag0 = false;
    }
    if (S[i] == '#') tmp0++;
    if (S[i] == '.') tmp1++;
    if (i == N - 1) {
      time += min(tmp0, tmp1);
    }
    if (i == N - 1 && S[i] == '.') {
      if (tmp0 > tmp1) continue;
      time -= tmp0;
      time += tmp1;
    }
    if (i == N - 1 && flag0 == true && S[0] == '.') {
      time -= tmp1;
    }
  }
  cout << time << endl;
}
