#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, ct1 = 0, ct2 = 0, ans = 0;
  string s, sc;
  bool b1 = 1, b2 = 1;
  cin >> n >> s;
  sc = s;
  for (int i = 0; i < n; i++) {
    if (b1 == 0 && b2 == 0 && s[i] == '#') {
      ans += min(ct1, ct2);
      ct1 = 0;
      ct2 = 0;
      b1 = 1;
      b2 = 1;
    }
    if (s[i] == '#') {
      b1 = 0;
      ct1++;
    } else if (s[i] == '.' && b1 == 0) {
      b2 = 0;
      ct2++;
    }
  }
  ans += min(ct1, ct2);
  cout << ans << "\n";
}
