#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, k = 0, m1 = 0, m2 = 0, j;
  char a[200050];
  k = 0;
  scanf("%d", &n);
  getchar();
  for (i = 0; i < n; i++) scanf("%c", &a[i]);
  i = 0;
  while (a[n - 1] == '#') n--;
  while (a[i] == '.') i++;
  j = i;
  for (i = j; i < n; i++) {
    m1 = m2 = 0;
    j = i;
    while (a[j] == '#' && i < n) {
      j++;
      m1++;
    }
    while (a[j] == '.' && i < n) {
      j++;
      m2++;
    }
    if (m1 <= m2)
      k += m1;
    else
      break;
  }
  m1 = m2 = 0;
  while (i < n) {
    if (a[i] == '#')
      m1++;
    else
      m2++;
    i++;
  }
  if (m1 <= m2)
    printf("%d\n", k + m1);
  else
    printf("%d\n", k + m2);
  return 0;
}
