#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1 << 29);
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int black, white;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    black = 1, white = 0;
    if (S[i] == '#') {
      if (i == N) break;
      while (S[i] == '#') {
        black++;
        i++;
      }
      while (S[i] == '.') {
        white++;
        i++;
      }
    }
    ans += min(black, white);
  }
  cout << ans << endl;
  return 0;
}
