#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;
  for (i = 0; i < S.size(); ++i) {
    if (S[i] == '#') {
      left.push_back(cnt_f);
      pos.push_back(i);
      ++cnt_f;
    }
    if (S[S.size() - 1 - i] == '#') {
      right.insert(right.begin(), cnt_b);
      ++cnt_b;
    }
  }
  int ans = 1000000;
  if (pos.empty()) ans = 0;
  for (i = 0; i < pos.size(); ++i) {
    int pat1 = left[i] + right[i] + 1;
    int pat2 = pos[i] - left[i] + S.size() - pos[i] - 1 - right[i];
    int pat3 = left[i] + S.size() - pos[i] - 1 - right[i];
    ans = min(ans, pat1);
    ans = min(ans, pat2);
    ans = min(ans, pat3);
  }
  cout << ans << endl;
}
