#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
string random_string(size_t length) {
  auto randchar = []() -> char {
    const char charset[] = "#.";
    const size_t max_index = (sizeof(charset) - 1);
    return charset[rand() % max_index];
  };
  string str(length, 0);
  generate_n(str.begin(), length, randchar);
  return str;
}
random_device rnd;
mt19937 mt(rnd());
uniform_int_distribution<> rand100(1, 30);
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i = 0;
  int ans = 0;
  while (s[i] == '.') i++;
  while (i < s.size()) {
    int c = 0;
    while (s[i] == '#' && i < s.size()) {
      i++;
      c++;
    }
    int c2 = 0;
    while (s[i] == '.' && i < s.size()) {
      i++;
      c2++;
    }
    ans += min(c, c2);
    if (c > c2) {
      if (s[i] == '#') i--;
      while (s[i] == '.' && i > 0) {
        s[i] = '#';
        i--;
      }
      if (s[i] == '.') i++;
    }
  }
  cout << ans << endl;
}
