#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  bool colors[N];
  for (long long i = 0, i_len = (N); i < i_len; ++i) colors[i] = S[i] == '#';
  ll cursor = -1;
  for (long long i = 0, i_len = (N); i < i_len; ++i) {
    if (!colors[i])
      ++cursor;
    else
      break;
  }
  ll b2w = 0;
  ll w2b = 0;
  for (long long i = (cursor + 1); i < (N); ++i) {
    if (colors[i]) ++b2w;
    if (!colors[i]) ++w2b;
  }
  for (ll i = N - 1; i >= 0; --i) {
    if (colors[i])
      --b2w;
    else
      break;
  }
  cout << max(min(b2w, w2b), (ll)0) << endl;
  return 0;
}
