#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const long long INF = 1000000000000000000;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  int b = 0, w = 0;
  S[N] += ' ';
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') b++;
    if (S[i] == '.') {
      w++;
      if (S[i + 1] == '#') {
        ans += min(b, w);
        b = 0;
        w = 0;
      }
    }
  }
  ans += min(b, w);
  cout << ans << endl;
}
