#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int bw = 0, wb = 0, ans = 0;
  while (true) {
    bw = s.find("#.", bw);
    wb = s.find(".#", wb);
    if (bw == string::npos) break;
    if (wb == string::npos) wb = n - 1;
    ans += wb - bw;
    if (bw == n - 2)
      break;
    else
      bw++;
    if (wb == n - 2)
      break;
    else
      wb++;
  }
  cout << ans << endl;
  return 0;
}
