#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
long long ans = 0;
int main() {
  cin >> N >> S;
  bool flag = 0;
  ans = 1 << 30;
  long long br = 0, wh = 0;
  long long tmp = 1;
  vector<int> bw;
  for (int i = 1; i < N; i++) {
    if (S[i] == S[i - 1]) {
      tmp++;
    } else {
      bw.push_back(tmp);
      tmp = 1;
    }
  }
  if (tmp > 0) bw.push_back(tmp);
  int sumwh = 0;
  for (int i = 0; i < bw.size(); i++) {
    if (S[0] == '#')
      if (i & 1)
        sumwh += bw[i];
      else {
        if (i & 1 == 0) sumwh += bw[i];
      }
  }
  for (int i = 0; i < bw.size(); i++) {
    if (S[0] == '#') {
      if (i & 1) {
        wh += bw[i];
      } else {
        tmp = br + sumwh - wh;
        ans = min(ans, tmp);
        br += bw[i];
      }
    } else {
      if (i & 1 == 0) {
        wh += bw[i];
      } else {
        tmp = br + sumwh - wh;
        ans = min(ans, tmp);
        br += bw[i];
      }
    }
  }
  ans = min(br, ans);
  cout << ans;
}
