#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int state = 0;
  ll black = 0;
  ll white = 0;
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    if (state == 0) {
      if (s[i] == '#') {
        black = 1;
        state = 1;
      }
    } else if (state == 1) {
      if (s[i] == '#') {
        black++;
      } else {
        white = 1;
        state = 2;
      }
    } else if (state == 2) {
      if (s[i] == '.') {
        white++;
      } else {
        ans += min(black, white);
        state = 1;
        black = 1;
      }
    }
  }
  if (state == 2) {
    ans += min(black, white);
  }
  cout << ans << endl;
  return 0;
}
