#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i;
  int count = 0;
  int cnt = 0;
  int a = 0;
  int co[n];
  for (i = 0; i < n; i++) {
    if (s[i] == '.')
      count++;
    else
      count--;
    co[i] = count;
  }
  int tmp = 0;
  int ab;
  int tm;
  for (i = 0; i < n; i++) {
    if (co[i] > tmp) ab = i;
  }
  for (i = 0; i < tm; i++) {
    if (s[i] == '#') cnt++;
  }
  for (i = tm; i < n; i++) {
    if (s[i] == '.') cnt++;
  }
  if (cnt == n) cnt = 0;
  cout << cnt << endl;
}
