#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <class T>
void cout_vec(const vector<T> &vec1) {
  for (long long i = 0; i < long long(vec1.size()); i++) {
    cout << vec1[i] << ' ';
  }
  cout << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  string s;
  cin >> n >> s;
  long long ans = 0;
  long long cnt1 = 0;
  long long cnt2 = 0;
  for (long long i = 0; i < n - 1; i++) {
    if (i <= n - 2 && s[i] == '#' && s[i + 1] == '.') {
      long long j = i, k = i;
      cnt1++;
      cnt2++;
      while (j - 1 >= 0 && s[j - 1] == '#') {
        cnt1++;
        j--;
      }
      while (k + 2 <= n - 1 && s[k + 2] == '.') {
        cnt2++;
        k++;
      }
      ans += min(cnt1, cnt2);
      i += min(cnt1, cnt2);
      if (cnt1 > cnt2 && i + 1 <= n - 1 && s[i + 1] == '#') {
        cnt1 = cnt2 + cnt1;
      } else {
        cnt1 = 0;
      }
      cnt2 = 0;
    }
  }
  cout << ans << endl;
}
