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