#include <bits/stdc++.h>
using namespace std;
long long N;
string S;
long long i = 0;
long long cnt_b;
long long cnt_w;
long long ans = 0;
long long ans2 = 0;
int main() {
  cin >> N;
  cin >> S;
  cnt_b = 0;
  cnt_w = 0;
  while (i < N) {
    while (S[i] == '#' && i < N) {
      cnt_b++;
      i++;
      if (i == N) break;
    }
    while (S[i] == '.' && i < N) {
      cnt_w++;
      i++;
    }
    if (cnt_w <= cnt_b) {
      ans += cnt_w;
      cnt_b += cnt_w;
      cnt_w = 0;
    } else {
      ans += cnt_b;
      cnt_b = 0;
      cnt_w = 0;
    }
  }
  for (i = 0; i < N; i++) {
    if (S[i] == '.')
      i++;
    else
      break;
  }
  reverse(S.begin(), S.end());
  cnt_b = 0;
  cnt_w = 0;
  N -= (i - 1);
  i = 0;
  while (i < N) {
    while (S[i] == '.' && i < N) {
      cnt_b++;
      i++;
      if (i == N) break;
    }
    while (S[i] == '#' && i < N) {
      cnt_w++;
      i++;
    }
    if (cnt_w <= cnt_b) {
      ans2 += cnt_w;
      cnt_b += cnt_w;
      cnt_w = 0;
    } else {
      ans2 += cnt_b;
      cnt_b = 0;
      cnt_w = 0;
    }
  }
  cout << min(ans, ans2) << endl;
}
