#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S;
  cin >> N >> S;
  long long inipos1 = S.find("#");
  long long inipos2 = S.rfind(".");
  if (inipos1 == -1 || inipos2 == -1) {
    cout << 0 << endl;
  } else {
    long long cnt1 = 0;
    long long cnt2 = 0;
    for (long long i = inipos1; i < N; i++) {
      if (S[i] == '.') cnt1++;
    }
    for (long long i = inipos2; i >= 0; i--) {
      if (S[i] == '#') cnt2++;
    }
    long long ans = min(cnt1, cnt2);
    int len = 0, mlen = 0;
    int ipos = 0, epos = 0;
    for (long long i = 0; i < N; i++) {
      if (S[i] == '#') {
        len++;
      } else {
        if (len > mlen) {
          mlen = len;
          epos = i - 1;
          ipos = epos - mlen + 1;
        }
        len = 0;
      }
    }
    long long t1 = 0, t2 = 0;
    for (long long i = 0; i < ipos; i++) {
      if (S[i] == '#') t1++;
    }
    for (long long i = epos; i < N; i++) {
      if (S[i] == '.') t2++;
    }
    ans = min(ans, t1 + t2);
    cout << ans << endl;
  }
  return 0;
}
