#include <bits/stdc++.h>
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main(void) {
  int N;
  int flag;
  int pre = 0;
  int post = 0;
  int black = 0;
  int white = 0;
  scanf("%d\n", &N);
  for (int i = 0; i < N; i++) {
    char c;
    char stone;
    scanf("%c", &c);
    if (c == '.')
      stone = 0;
    else
      stone = 1;
    if (stone == 1) {
      black++;
      if (black < white) pre++;
    } else if (black > 0) {
      white++;
      if (pre < black) post++;
    }
  }
  int temp[3] = {white, black, pre + post};
  qsort(temp, 4, sizeof(int), compare_int);
  printf("%d", temp[0]);
  return 0;
}
