#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S;
  cin >> N >> S;
  int black = 0;
  long long black_count = 0;
  long long all_b_count = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      black = 1;
      black_count += 1;
    }
    if ((black = 1) && (S[i] == '.')) {
      all_b_count += black_count;
      black_count = 0;
      black = 0;
    }
  }
  int white = 0;
  long long white_count = 0;
  long long all_w_count = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '.') {
      white = 1;
      white_count += 1;
    }
    if ((white = 1) && (S[i] == '#')) {
      all_w_count += white_count;
      white_count = 0;
      white = 0;
    }
  }
  if (all_w_count > all_b_count) {
    cout << all_b_count;
  } else {
    cout << all_w_count;
  }
}
