#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> v;
  char now = '#';
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == now)
      cnt++;
    else {
      v.push_back(cnt);
      if (now == '#')
        now = '.';
      else
        now = '#';
      cnt = 1;
    }
  }
  if (cnt != 0) v.push_back(cnt);
  if (s[s.size() - 1] == '#') v.push_back(0);
  int ans = 0;
  bool flag = true;
  for (int i = 0; i < v.size(); i += 2) {
    if (flag && v[i] <= v[i + 1]) {
      ans += v[i];
      continue;
    } else
      flag = false;
    if (flag == false) ans += v[i + 1];
  }
  cout << ans << endl;
  return 0;
}
