#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  int bNum = 0;
  int wNum = 0;
  vector<int> ans;
  cin >> N;
  cin >> S;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') bNum++;
    if (S[i] == '.') wNum++;
  }
  if (bNum == 0 || wNum == 0) {
    cout << "0" << endl;
    return 0;
  }
  int BtoW = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      ans.push_back(wNum + BtoW);
      BtoW += 1;
    } else {
      wNum -= 1;
    }
  }
  int minAns = *min_element(ans.begin(), ans.end());
  cout << minAns << endl;
}
