#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
vector<pair<char, ll>> RLE(const string &S) {
  ll cnt = 0;
  vector<pair<char, ll>> res;
  for (ll i = 0; i < (ll)S.size(); i++) {
    cnt++;
    if (i == (ll)S.size() - 1) {
      res.emplace_back(S[i], cnt);
      break;
    }
    if (S[i] != S[i + 1]) {
      res.emplace_back(S[i], cnt);
      cnt = 0;
    }
  }
  return res;
}
void Main() {
  ll N;
  cin >> N;
  string S;
  cin >> S;
  vector<pair<char, ll>> res = RLE(S);
  ll b_cnt = 0, w_cnt = 0;
  for (ll i = 0; i < (ll)(res.size()); i++) {
    if (i == 0 && res[i].first == '.') {
      ;
    }
    if (i == (res.size() - 1) && res[i].first == '#') {
      ;
    }
    if (res[i].first == '#') {
      b_cnt += res[i].second;
    }
    if (res[i].first == '.') {
      w_cnt += res[i].second;
    }
  }
  cout << min(b_cnt, w_cnt) << endl;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
