#include <bits/stdc++.h>
static const long long MOD_NUM = 1000000007;
template <class _T>
static void getint(_T& a) {
  const char* fmt = " %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld";
  }
  if (scanf(fmt, &a) < 0) {
    printf("g1int Error\n");
  }
}
template <class _T>
static void getint(_T& a, _T& b) {
  const char* fmt = " %d %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld %lld";
  }
  if (scanf(fmt, &a, &b) < 0) {
    printf("g2int Error\n");
  }
}
template <class _T>
static void getint(_T& a, _T& b, _T& c) {
  const char* fmt = " %d %d %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld %lld %lld";
  }
  if (scanf(fmt, &a, &b, &c) < 0) {
    printf("g3int Error\n");
  }
}
static void Tenk1PBC2019C();
int main() {
  Tenk1PBC2019C();
  fflush(stdout);
  return 0;
}
static void Tenk1PBC2019C() {
  int N;
  getint(N);
  std::string orgs;
  std::cin >> orgs;
  int ans = 0;
  int white = 0, black = 0;
  char bfr = 0;
  for (int i = 0; i < N; i++) {
    if (orgs[i] == '#') {
      if (bfr != '#') {
        ans += std::min(black, white);
        black = white = 0;
      }
      black++;
    } else if (black) {
      white++;
    }
    bfr = orgs[i];
  }
  ans += std::min(black, white);
  printf("%d\n", ans);
}
