#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 b = 0, w = 0;
  for (ll i = 0; i < (ll)n; i++) {
    if (s[i] == '#')
      b++;
    else if (b > 0)
      w++;
  }
  cout << min(b, w) << endl;
  return 0;
}
