#include <bits/stdc++.h>
int main(void) {
  int N;
  char S[200001];
  scanf("%d", &N);
  scanf("%s", S);
  int X = 0;
  int B = 0;
  int W = 0;
  if (S[0] == '#')
    B++;
  else
    W++;
  for (int i = 1; i < N; i++) {
    if (S[i] == '#') {
      if (S[i - 1] == '#') {
        B++;
      } else {
        B = 1;
        W = 0;
      }
      continue;
    }
    if (S[i - 1] != '#') {
      W++;
      continue;
    }
    W = 1;
    int j;
    for (j = i + 1; j < N; j++) {
      if (S[j] == '#') break;
      W++;
    }
    if (B <= W) {
      X += B;
      W = B + 1;
      B = 0;
    } else {
      X += W;
      S[i] = '#';
      B++;
      W = 0;
    }
  }
  printf("%d\n", X);
  return 0;
}
