#include <bits/stdc++.h>
using namespace std;
void YES(bool flag) { cout << (flag ? "YES" : "NO") << endl; }
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
void yes(bool flag) { cout << (flag ? "yes" : "no") << endl; }
const int INF = 1e7;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int bnum = count(s.begin(), s.end(), '#');
  ;
  int wnum = 0;
  int ans = INF;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      bnum--;
    } else {
      wnum++;
    }
    ans = min(ans, n - i - 1 - bnum + i + 1 - wnum);
  }
  cout << ans << endl;
  return 0;
}
