#include <bits/stdc++.h>
using namespace std;
int ans = 0;
int n;
int first_black = 0;
int blacks = 0;
string s;
void solve() {
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      first_black = n - i;
      break;
    }
  }
  if (first_black <= 2 * blacks) {
    ans += (first_black - blacks);
  } else {
    s[n - first_black] = '.';
    ans++;
    first_black = 0;
    blacks--;
    solve();
  }
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      blacks++;
    }
  }
  solve();
  cout << ans << endl;
  return 0;
}
