#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  const char B = '#';
  const char W = '.';
  int n;
  cin >> n;
  string s;
  cin >> s;
  int b = 0, w = 0, cb = 0, cw = 0;
  for (int i = 0; i < (n); i++) {
    if (s[i] == B) {
      b++;
    } else {
      w++;
      cb = w;
    }
    if (b > 0 && s[i] == W) cw++;
  }
  int ans = min(b, w);
  ans = min(ans, cb);
  ans = min(ans, cw);
  cout << ans << '\n';
  return 0;
}
