#include <bits/stdc++.h>
using namespace std;
const int max_n = 1e5;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
const int inf = 1 << 30;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
long long mo = 998244353;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> v;
  if (s[0] == '#') v.push_back(0);
  for (int i = 0; i < n; i++) {
    int j = i;
    while (s[i] == s[j] && j < n) {
      j++;
    }
    v.push_back(j - i);
    i = j - 1;
  }
  if (s.back() == '#') v.push_back(0);
  long long ans = 0;
  for (int i = 2; i < v.size(); i += 2) {
    if (v[i - 1] < v[i]) {
      ans += v[i - 1];
      v[i - 1] = 0;
    } else {
      ans += v[i];
      v[i] = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
