#include <bits/stdc++.h>
using namespace std;
const int INF = 10000000;
int main(int argc, char *argv[]) {
  int N, a[300000], b[300000];
  string S;
  cin >> N;
  cin >> S;
  if (S[0] == '#') {
    a[0] = 1;
  } else {
    a[0] = 0;
  }
  if (S[N - 1] == '.') {
    b[N - 1] = 1;
  } else {
    b[N - 1] = 0;
  }
  for (int i = 1; i < N; i++) {
    if (S[i] == '#') {
      a[i] = a[i - 1] + 1;
    } else {
      a[i] = a[i - 1];
    }
  }
  for (int i = N - 2; i >= 0; i--) {
    if (S[i] == '.') {
      b[i] = b[i + 1] + 1;
    } else {
      b[i] = b[i + 1];
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (a[i] >= b[i]) {
      if (i - 1 >= 0) {
        ans += a[i - 1];
      }
      ans += b[i];
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
