#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
const long long LINF = 1e11;
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; }
int N;
string S;
int AllW;
int AllB;
int calcTailStart() {
  int res = 0;
  int w = 0;
  int b = 0;
  bool f = true;
  bool mushi = S[N - 1] == '#';
  for (int i = N - 1; i >= 0; --i) {
    if (mushi && S[i] == '#') {
      continue;
    } else {
      mushi = false;
    }
    if (S[i] == '.') {
      w++;
    } else {
      b++;
    }
    if (i == 0 || S[i] != S[i - 1]) {
      if (f) {
        f = false;
        continue;
      } else {
        if (w <= b) {
          res += w;
          w = 0;
          b = 0;
        } else {
          res += b;
          w += b;
          b = 0;
        }
        f = true;
      }
    }
  }
  return res;
}
int calcTailStart2() {
  int res = 0;
  int w = 0;
  int b = 0;
  bool f = true;
  bool mushi = S[N - 1] == '#';
  for (int i = N - 1; i >= 0; --i) {
    if (mushi && S[i] == '#') {
      continue;
    } else {
      mushi = false;
    }
    if (S[i] == '.') {
      w++;
    } else {
      b++;
    }
    if (i == 0 || S[i] != S[i - 1]) {
      if (f) {
        f = false;
        continue;
      } else {
        if (w < b) {
          res += w;
          w = 0;
          b = 0;
        } else {
          res += b;
          w += b;
          b = 0;
        }
        f = true;
      }
    }
  }
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  cin >> S;
  int ans = calcTailStart();
  ans = min(ans, calcTailStart2());
  AllW = 0;
  AllB = 0;
  for (int i = 0; i < N; ++i) {
    if (S[i] == '.') {
      AllW++;
    } else {
      AllB++;
    }
  }
  ans = min(ans, AllW);
  ans = min(ans, AllB);
  cout << ans << endl;
  return 0;
}
