#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> pos;
  vector<int> left;
  vector<int> right;
  int i;
  int cnt_f = 0;
  int cnt_b = 0;
  int cnt_1 = 0;
  int cnt_2 = 0;
  for (i = 0; i < S.size(); ++i) {
    if (S[i] == '#') {
      left.push_back(cnt_f);
      pos.push_back(i);
      ++cnt_f;
      ++cnt_1;
    } else {
      ++cnt_2;
    }
    if (S[S.size() - 1 - i] == '#') {
      right.insert(right.begin(), cnt_b);
      ++cnt_b;
    }
  }
  if (cnt_1 == 0 || cnt_2 == 0) {
    cout << 0 << endl;
  } else {
    int ans = 1000000;
    int pat3 = 0;
    if (pos.empty()) ans = 0;
    for (i = 0; i < pos.size(); ++i) {
      pat3 = left[i] + S.size() - pos[i] - 1 - right[i];
      ans = min(ans, pat3);
    }
    ans = min(ans, cnt_1);
    ans = min(ans, cnt_2);
    cout << ans << endl;
  }
}
