#include <bits/stdc++.h>
using namespace std;
template <class T>
bool contain(const std::string &s, const T &v) {
  return s.find(v) != std::string::npos;
}
unsigned long long mod = 1e9 + 7;
int main() {
  int n, cnt1 = 0, cnt2 = 0, ans = 0;
  int cnt3 = 0, cnt4 = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '#')
      cnt1++;
    else
      cnt2++;
    if (s[i] == '.' && s[i + 1] == '#') {
      if (cnt1 <= cnt2) {
        ans += cnt1;
      } else {
        ans += cnt2;
      }
      cnt1 = 0;
      cnt2 = 0;
    }
  }
  if (s[n - 2] == '#' && s[n - 1] == '.') ans++;
  cout << ans << endl;
}
