#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  int firstBlackIndex = -1;
  for (int i = 0; i < N; ++i) {
    if (S[i] == '#') {
      int wCnt = 0;
      int bCnt = 1;
      bool flag = false;
      for (int j = i + 1; j < N; ++j) {
        if (S[j] == '.') {
          flag = true;
          ++wCnt;
        } else {
          ++bCnt;
          if (flag) {
            if (wCnt > bCnt) {
              ans += bCnt;
            } else {
              ans += wCnt;
              firstBlackIndex = i;
            }
          }
        }
      }
      if (firstBlackIndex != -1) break;
    }
  }
  int ans0 = ans;
  int ans1 = 0;
  if (firstBlackIndex == -1) {
    cout << 0 << endl;
  } else {
    int ans;
    for (int i = firstBlackIndex; i < N; ++i) {
      if (S[i] == '.') ++ans0;
    }
    for (int i = 0; i < N; ++i) {
      if (S[i] == '#') ++ans1;
    }
    ans = min(ans0, ans1);
    cout << ans << endl;
  }
  return 0;
}
