#include <bits/stdc++.h>
static const long long int MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int main() {
  long long int n;
  cin >> n;
  long long int b = -1, w = 0;
  string s;
  cin >> s;
  for (int i = 0; i < (int)(s.length()); i++) {
    if (s[i] == '#')
      b++;
    else if (b >= 0)
      w++;
  }
  if (b == -1)
    cout << 0;
  else
    cout << min(b, w);
}
