#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<pair<long long int, long long int> > a;
  int p;
  int cnt = 1;
  if (s[0] == '#')
    p = 0;
  else
    p = 1;
  for (int i = 1; i < n; i++) {
    int now;
    if (s[i] == '#')
      now = 0;
    else
      now = 1;
    if (p == now) {
      cnt++;
    } else {
      a.push_back(pair<long long int, long long int>(p, cnt));
      p = now;
      cnt = 1;
    }
  }
  a.push_back(pair<long long int, long long int>(p, cnt));
  int res = 1e9;
  int btow = 0;
  int wtob = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i].first == 1) btow += a[i].second;
  }
  for (int i = 0; i < a.size(); i++) {
    if (a[i].first == 0) {
      wtob += a[i].second;
    }
    if (a[i].first == 1) {
      btow -= a[i].second;
    }
    res = min(res, btow + wtob);
  }
  cout << res << endl;
  return 0;
}
