#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S;
  cin >> N >> S;
  int cnt = 0;
  int B = 0, W = 0, B_sum = 0;
  bool flag = false;
  for (int i = 1; i < N; i++) {
    if (S.at(i - 1) == '#' && S.at(i) == '.') {
      cnt++;
      B_sum += B;
      flag = true;
      B_sum = 0;
    } else if (S.at(i) == '#') {
      B++;
    } else if (flag && S.at(i - 1) != '#' && S.at(i) == '.') {
      W++;
    }
  }
  cout << cnt + min(B_sum, W) << endl;
}
