#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
int main() {
  int n;
  string s;
  cin >> n >> s;
  ll bw = 0, ww = 0;
  for (ll i = 0; i < (ll)n; i++) {
    if (s[i] == '#')
      bw++;
    else if (bw > 0)
      ww++;
  }
  ll bb = 0, wb = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.')
      wb++;
    else if (wb > 0)
      bb++;
  }
  cout << min(ww, bb) << endl;
  return 0;
}
