#include <bits/stdc++.h>
static void C_Stones();
int main() {
  C_Stones();
  fflush(stdout);
  return 0;
}
static void C_Stones() {
  static char stones[100004 * 2] = {0};
  int N = 0;
  scanf(" %d %s", &N, stones);
  int bkCount = 0, bkCount2 = 0;
  int whtCount = 0, whtCount2 = 0;
  int periodIdx = 0;
  int chgCount = 0;
  for (int i = 0; i < N; i++) {
    if (stones[i] == '#') {
      if (whtCount) {
        periodIdx = i;
        chgCount += (bkCount > whtCount) ? whtCount : bkCount;
        bkCount = whtCount = 0;
      }
      bkCount++;
    } else if ((stones[i] == '.') && (bkCount)) {
      whtCount++;
    }
  }
  chgCount += (bkCount > whtCount) ? whtCount : bkCount;
  printf("%d\n", chgCount);
}
