#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  string S;
  cin >> N >> S;
  ll count0 = 0;
  ll count1 = 0;
  for (ll i = 0; i < S.size(); i++) {
    if (S[i] == '#') {
      break;
    }
    count0++;
  }
  S.erase(S.begin() + 0, S.begin() + count0);
  for (ll i = S.size() - 1; i >= 0; i--) {
    if (S[i] == '.') {
      break;
    }
    count1++;
  }
  S.erase(S.end() - count1, S.end());
  if (S.size() == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<ll> H;
  ll ct = 1;
  for (ll i = 1; i < S.size(); i++) {
    if (S[i] != S[i - 1]) {
      H.push_back(ct);
      ct = 1;
    } else {
      ct++;
    }
  }
  H.push_back(ct);
  ll ans = 1000000000;
  vector<ll> G;
  vector<ll> K;
  G[0] = 0;
  K[0] = 1;
  for (ll i = 0; i < H.size(); i += 2) {
    G.push_back(G[i] + H[i]);
  }
  for (ll i = 1; i < H.size(); i += 2) {
    K.push_back(K[i] + H[i]);
  }
  for (ll i = 1; i <= H.size() / 2; i++) {
    ll sum = 0;
    sum += G[i] + K[H.size() / 2] - K[i];
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
