#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = acos(-1);
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}
int main() {
  ll n;
  string s;
  cin >> n >> s;
  ll black = 0, white = 0, ans = 0;
  bool z = false;
  for (ll i = n - 1; i >= 0; --i) {
    if (s[i] == '#')
      black++;
    else {
      if (black != 0) {
        if (black >= white) {
          ans += white;
          black = white = 0;
        } else {
          ans += black;
          white += black;
          black = 0;
        }
      }
      white++;
    }
  }
  if (black >= white) {
    ans += white;
    black = white = 0;
  } else {
    ans += black;
    white += black;
    black = 0;
  }
  cout << ans << endl;
  return 0;
}
