#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 whiteCount = 0, blackCount = 0;
  for (int i = 0; i < N; i++) {
    if (orgs[i] == '#') {
      blackCount++;
    } else {
      whiteCount++;
    }
  }
  int passedWhite = 0, passedBlack = 0;
  for (int i = 0; i < N; i++) {
    int changeCount = 0;
    if (orgs[i] == '#') {
      passedBlack++;
    } else {
      if (passedBlack) {
        if (passedBlack < (whiteCount - passedWhite)) {
          ans += passedBlack;
          passedBlack = 0;
        } else {
          ans += (whiteCount - passedWhite);
          break;
        }
      }
      passedWhite++;
    }
  }
  printf("%d\n", ans);
}
