#include <bits/stdc++.h>
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int ny, nx;
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int m, long long int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
long long int llpow(long long int x, long long int y) {
  long long int ans = 1;
  for (int i = 0, i_len = (y); i < i_len; ++i) ans *= x;
  return ans;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
int main() {
  int N;
  string S;
  cin >> N >> S;
  int res = 0, Wcnt = 0, Bcnt = 0;
  int ans = 0;
  int reset = 0;
  reverse(S.begin(), S.end());
  bool flag = false;
  if (S[0] == '#' and S[1] == '.') flag = true;
  for (int i = 0, i_len = (S.size()); i < i_len; ++i) {
    if (S[i] == '.') {
      Wcnt++;
    } else {
      Bcnt++;
    }
    if (res < Bcnt) {
      ans += Wcnt;
      Wcnt = 0;
      reset++;
    }
    res = Bcnt;
  }
  int len = S.size();
  int trueans = min(ans, len - ans);
  if (reset == 2 and len != 3) trueans--;
  cout << trueans << endl;
  return 0;
}
