#include <bits/stdc++.h>
using namespace std;
int cnt[200010];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1e9;
  int a = 0;
  int cnt2 = 0;
  int res2 = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '#' && s[i + 1] == '.') {
      cnt[a] = i;
      a++;
    }
    if (s[i] == '#' && s[i + 1] == '#') {
      cnt[a] = i;
      a++;
    }
  }
  bool flag = false;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == '#') {
      flag = true;
    }
    if (flag && s[i + 1] == '.') {
      cnt2++;
    }
  }
  ans = min(ans, cnt2);
  for (int i = 0; i < a - 1; i++) {
    res2 = res2 + (cnt[i + 1] - cnt[i]);
    cnt2 = cnt2 - (cnt[i + 1] - cnt[i]);
    ans = min(ans, res2 + cnt2);
  }
  cout << ans << endl;
  return 0;
}
