#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  string s;
  cin >> s;
  vector<ll> black_sum(n + 1, 0), white_sum(n + 1, 0);
  for (long long i = 0; i < (long long)(n); i++) {
    black_sum[i + 1] = black_sum[i] + (s[i] == '#' ? 1 : 0);
    white_sum[i + 1] = white_sum[i] + (s[i] == '#' ? 0 : 1);
  }
  ll ans = 1145141919810;
  for (long long i = 0; i < (long long)(n + 1); i++) {
    ans = min(black_sum[i] + white_sum[n - i], ans);
  }
  bool all_same_color = true;
  for (long long i = 0; i < (long long)(n); i++) {
    if (s[i] != s.front()) all_same_color = false;
  }
  if (all_same_color) ans = 0;
  cout << ans << endl;
}
