#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, W_sum = 0;
  bool flag = false;
  for (int i = 1; i < N; i++) {
    if (S.at(i - 1) == '#' && S.at(i) == '.') {
      cnt++;
      B_sum += B;
      W_sum += W;
      B = 0;
      W = 0;
      flag = true;
    } else if (S.at(i) == '#') {
      B++;
    } else if (flag == true && S.at(i) == '.') {
      W++;
    }
  }
  cout << cnt + min(B_sum, W_sum) << endl;
}
