#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1e18;
const long long mod = 1e9 + 7;
const double eps = 0.000000001;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> dp1(n + 1), dp2(n + 1);
  for (long long i = 1; i <= n; i++) {
    if (s[i - 1] == '#')
      dp1[i] = dp1[i - 1] + 1;
    else
      dp1[i] = dp1[i - 1];
  }
  for (long long i = n; i >= 1; i--) {
    if (s[i - 1] == '#')
      dp2[i - 1] = dp2[i] + 1;
    else
      dp2[i - 1] = dp2[i];
  }
  for (long long i = 0; i <= n; i++) {
  }
  long long ans = INF;
  for (long long i = 0; i < n; i++) {
    ans = min(ans, dp1[i] + min(dp2[i + 1], n - i - dp2[i + 1]));
  }
  cout << ans << endl;
  return 0;
}
