#include <bits/stdc++.h>
const int N = 200005;
char a[N];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", a);
  int ans = 0;
  for (int i = 1; i < n;) {
    if (a[i] == '.' && a[i - 1] == '#') {
      int j = i - 1, k = i;
      int change_left = 0;
      int change_right = 0;
      while (k < n && a[k] == '.') {
        k++;
        change_right++;
      }
      while (change_left <= change_right && j >= 0 && a[j] == '#') {
        j--;
        change_left++;
      }
      if (change_right < change_left) {
        for (int w = i; w < k; w++) {
          a[w] = '#';
        }
      } else {
        for (int w = i - 1; w > j; w--) {
          a[w] = '.';
        }
      }
      i = k;
      ans += std::min(change_left, change_right);
    } else {
      i++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
