#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin >> N >> S;
  int count0 = 0;
  int count1 = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == '#') {
      break;
    }
    count0++;
  }
  S.erase(S.begin() + 0, S.begin() + count0);
  for (int i = S.size() - 1; i >= 0; i--) {
    if (S[i] == '.') {
      break;
    }
    count1++;
  }
  S.erase(S.end() - count1, S.end());
  if (S.size() == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> H;
  int ct = 1;
  for (int i = 1; i < S.size(); i++) {
    if (S[i] != S[i - 1]) {
      H.push_back(ct);
      ct = 1;
    } else {
      ct++;
    }
  }
  H.push_back(ct);
  int ans = 1000000000;
  for (int i = 0; i <= H.size(); i++) {
    int sum = 0;
    bool flag = false;
    for (int j = 0; j < i; j++) {
      if (j % 2 == 0) sum += H[j];
      if (sum > ans) {
        flag = true;
        break;
      }
    }
    for (int j = i; j < H.size(); j++) {
      if (j % 2 != 0) sum += H[j];
      if (sum > ans) {
        flag = true;
        break;
      }
    }
    if (flag) continue;
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
