#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  while (s.back() == '#') s.pop_back();
  while (s.front() == '.') s.erase(s.begin());
  ll wcnt = 0;
  for (ll i = 0; i < s.size(); ++i)
    if (s[i] == '.') ++wcnt;
  ll ans = s.size();
  ll bcnt = 0;
  for (ll i = 0; i < s.size(); ++i) {
    if (s[i] == '#')
      ans = min(ans, wcnt + bcnt), ++bcnt;
    else
      --wcnt;
  }
  cout << ans << endl;
}
