#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  string S;
  bool Flag = false;
  bool Flag2 = false;
  vector<long long int> res(0);
  cin >> N >> S;
  vector<long long int> Black;
  for (long long int i = 0; i < N; i++) {
    if (!Flag) {
      if (S[i] == '#') {
        Flag = true;
        res.push_back(0);
        if (Black.size() == 0) {
          int black_temp = 0;
          int j = 0;
          while (i + j < N && S[i + j] == '#') {
            black_temp++;
            j++;
          }
          Black.push_back(black_temp);
        }
        continue;
      }
    }
    if (Flag) {
      if (S[i] == '.') {
        for (int k = 0; k < res.size(); k++) {
          res[k] = res[k] + 1;
        }
      }
      if (S[i] == '#') {
        Flag = false;
        int black_temp = 0;
        int j = 0;
        while (i + j < N && S[i + j] == '#') {
          black_temp++;
          j++;
        }
        Black.push_back(black_temp);
      }
    }
  }
  long long int min = 0;
  for (int i = 0; i < res.size(); i++) {
    long long int min_temp = res[i];
    for (int k = 0; k < i; k++) {
      min_temp += Black[k];
    }
    if (min_temp < min || i == 0) min = min_temp;
  }
  cout << min << endl;
  return 0;
}
