#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> lbfw(n);
  int nlb = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#')
      nlb++;
    else
      lbfw[i] = nlb;
  }
  int rw = 0;
  int ans = 1000000007;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.') {
      ans = min(ans, lbfw[i] + rw);
      rw++;
    }
  }
  if (ans == 1000000007) ans = 0;
  cout << ans << endl;
  return 0;
}
