#include <bits/stdc++.h>
using namespace std;
using ll = long long;
namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
}  // namespace NS
const char black = '#';
const char white = '.';
int main() {
  ll N;
  string S;
  cin >> N >> S;
  vector<pair<char, ll>> cal;
  ll b, w;
  b = w = 0;
  for (ll i = 0; i < N; ++i) {
    if (S[i] == white) {
      if (b > 0) {
        cal.push_back(make_pair(black, b));
        b = 0;
        w = 0;
      }
      ++w;
    } else {
      if (w > 0) {
        cal.push_back(make_pair(white, w));
        b = 0;
        w = 0;
      }
      ++b;
    }
  }
  if (b == 0) {
    cal.push_back(make_pair(white, w));
  } else {
    cal.push_back(make_pair(black, b));
  }
  int64_t ans = INT64_MAX, tmpAns = 0;
  ll calSize = cal.size();
  for (ll i = 1; i < calSize; ++i) {
    if (cal[i].first == white) {
      tmpAns += cal[i].second;
    }
  }
  ans = tmpAns;
  tmpAns = 0;
  for (ll i = 0; i < calSize - 1; ++i) {
    if (cal[i].first == black) {
      tmpAns += cal[i].second;
    }
  }
  ans = min(ans, tmpAns);
  cout << ans << endl;
}
