#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long power(long long x, long long p) {
  long long a = 1;
  while (p > 0) {
    if (p % 2 == 0) {
      x *= x;
      p /= 2;
    } else {
      a *= x;
      p--;
    }
  }
  return a;
}
int main() {
  int N, c = 0, a = 0, b = 0;
  bool flag = false;
  scanf("%d", &N);
  char* s = new char[N + 1];
  scanf("%s", s);
  while (*s) {
    if (*s == '#') flag = true;
    if (flag) {
      c++;
      if (*s != *(s + 1)) {
        if (*s == '#')
          a += c;
        else
          b += c;
        c = 0;
      }
    }
    s++;
  }
  printf("%d\n", min(a, b));
  return 0;
}
