#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  int a = 0;
  int b, c, db, e, ab;
  b = 0;
  int d = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '.' && a == i) a++;
  }
  if (a == 0) {
    for (int i = 0; i < N; i++) {
      if (S[i] == '#' && ab == i) ab++;
      if (S[i] == '.' && ab + a == i) a++;
    }
  }
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') b++;
  }
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') {
      if (d != 0) db = d;
      d = 0;
    } else
      d = d + 1;
  }
  if (d == 0) d = db;
  c = N - b;
  b = b - a;
  c = c - d;
  if (c >= b)
    cout << b << endl;
  else
    cout << c << endl;
}
