#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> v;
  char now = '#';
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (now == s[i])
      cnt++;
    else {
      v.push_back(cnt);
      if (now == '#')
        now = '.';
      else
        now = '#';
      cnt = 1;
    }
  }
  if (cnt != 0) v.push_back(cnt);
  if (now == '#') v.push_back(0);
  for (int i = 0; i < v.size(); i += 2) v[i + 2] += v[i];
  for (int i = v.size() - 1; i >= 0; i -= 2) v[i - 2] += v[i];
  int ans = 1e9;
  for (int i = 0; i < v.size(); i += 2) ans = min(ans, v[i] + v[i + 1]);
  ans = min({ans, v[1], v[v.size() - 2]});
  cout << ans << endl;
  return 0;
}
