#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll b = 0, w = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '.')
      w++;
    else
      b++;
  }
  ll shiro = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      shiro = i + 1;
      break;
    }
  }
  ll kuro = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.') {
      kuro = i + 1;
      break;
    }
  }
  if (shiro - kuro == 1 || kuro == 0 || shiro == 0) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = min(kuro - (b - (n - kuro)), (n - shiro) - (w - shiro));
  cout << ans << endl;
}
