#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll MOD = 1000000007;
const long long dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const long long dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<ll> cntb(n + 1), cntw(n + 1);
  for (long long i = 1; i <= n; i++) {
    cntb[i] += cntb[i - 1];
    if (s[i - 1] == '#') cntb[i]++;
  }
  for (long long i = n - 1; i >= 0; i--) {
    cntw[i] += cntw[i + 1];
    if (s[i] == '.') cntw[i]++;
  }
  ll ans = 9223372036854775807LL;
  for (long long i = 0; i < (n); ++i) {
    if (s[i] == '#') {
      cerr << "i"
           << ": " << (i) << ", "
           << "cntb[i]"
           << ": " << (cntb[i]) << ", "
           << "cntw[i]"
           << ": " << (cntw[i]) << '\n';
      ans = min(ans, cntb[i] + cntw[i]);
    }
  }
  if (ans == 9223372036854775807LL)
    std::cout << (0) << "\n";
  else
    std::cout << (ans) << "\n";
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  cout << fixed << setprecision(12);
  solve();
}
