#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;
const int MOD = 1000000007;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int b = 0;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == '#') {
      b++;
      continue;
    }
    if (b == 0) {
      continue;
    }
    int w = 1;
    for (int j = i + 1; j < N; j++) {
      if (s[j] != '.') break;
      w++;
    }
    ans += min(w, b);
    b = 0;
  }
  cout << ans << endl;
}
