#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] != '#') break;
    cnt++;
  }
  int bcnt = 0;
  int wcnt = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#')
      bcnt++;
    else
      wcnt++;
  }
  cout << min(wcnt, bcnt - cnt) << endl;
  return 0;
}
