#include <bits/stdc++.h>
void swap(long long *a, long long *b) {
  long long c;
  c = *b;
  *b = *a;
  *a = c;
}
long long max2(long long a, long long b) { return a >= b ? a : b; }
long long min2(long long a, long long b) { return a >= b ? b : a; }
long long min3(long long a, long long b, long long c) {
  return (a <= b && a <= c) ? a : b <= c ? b : c;
}
long long max3(long long a, long long b, long long c) {
  return (a >= b && a >= c) ? a : b >= c ? b : c;
}
long long minn(long long n, long long a[n]) {
  long long b = (1LL << 60);
  for (long long i = (0); i < (n); i++) b = min2(b, a[i]);
  return b;
}
long long maxn(long long n, long long a[n]) {
  long long b = -(1LL << 60);
  for (long long i = (0); i < (n); i++) b = max2(b, a[i]);
  return b;
}
long long ABS(long long a) { return a >= 0 ? a : (-a); }
long long POW(long long a, long long b) {
  long long c = 1;
  for (long long i = (0); i < (b); i++) c *= a;
  return c;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long mod(long long n) { return n %= 1000000007; }
int upll(const void *a, const void *b) {
  return *(long long *)a < *(long long *)b   ? -1
         : *(long long *)a > *(long long *)b ? 1
                                             : 0;
}
int downll(const void *a, const void *b) {
  return *(long long *)a < *(long long *)b   ? 1
         : *(long long *)a > *(long long *)b ? -1
                                             : 0;
}
void sortup(long long *a, int n) { qsort(a, n, sizeof(long long), upll); }
void sortdown(long long *a, int n) { qsort(a, n, sizeof(long long), downll); }
typedef struct {
  long long aa, bb;
} fr;
int cmp1(const void *p, const void *q) { return ((fr *)p)->aa - ((fr *)q)->aa; }
int main(void) {
  char s[200005];
  long long n, ans = 0;
  scanf("%lld%s", &n, s);
  long long bw[n], black;
  bw[n - 1] = 0;
  for (long long i = (n - 2); i >= (0); i--) {
    bw[i] = bw[i + 1];
    if (s[i + 1] == '#') bw[i]++;
  }
  black = bw[0];
  if (s[0] == '#') black++;
  if (s[0] == '#') {
    ans = (n - 1) - bw[0];
  } else {
    ans = (n - 1) - (bw[0] + 1);
  }
  for (long long i = (1); i < (n); i++) {
    if (s[i] == '.') {
      ans = min2(ans, (black - bw[i]) + 1 + (n - 1 - i) - bw[i]);
    } else {
      ans = min2(ans, (black - bw[i]) + (n - 1 - i) - bw[i]);
    }
  }
  ans = min2(ans, black);
  printf("%lld\n", ans);
  return 0;
}
