#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  vector<long long int> num;
  long long int n;
  char now;
  long long int cnt = 0;
  long long int ans = 0;
  cin >> n >> s;
  string t(s);
  now = s[0];
  cnt++;
  for (int i = 1; i < s.size(); i++) {
    if (now != s[i]) {
      now = s[i];
      num.push_back(cnt);
      cnt = 1;
    } else {
      s.erase(s.begin() + i);
      i--;
      cnt++;
    }
  }
  num.push_back(cnt);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '#') {
      if (s[i + 1] == '.') {
        ans += min(num[i], num[i + 1]);
      }
    }
  }
  cout << ans << endl;
}
