#include <bits/stdc++.h>
using namespace std;
const long long int MaxN = 10000005;
const long long int mod = 1e9 + 7;
const float pi = 3.1415926535897932384626433832795028;
long long int mcd(long long int a, long long int b) {
  if (a == 0) return b;
  return mcd(b % a, a);
}
int pre0[MaxN], pre1[MaxN], suf0[MaxN], suf1[MaxN];
void solve() {
  long long int N, i, j, p = 0, q = 0, res = 1e9, negro = 0;
  string bin;
  cin >> N;
  cin >> bin;
  bin = '0' + bin;
  if (N == 1) {
    cout << "0\n";
    return;
  }
  pre0[0] = 0, pre1[0] = 0;
  suf0[N + 1] = 0, suf1[N + 1] = 0;
  for (i = 1; i <= N; i++) {
    p = 0, q = 0;
    if (bin[i] == '#') {
      negro += 1;
      p = 1;
    } else {
      q = 1;
    }
    pre1[i] = pre1[i - 1] + p;
    pre0[i] = pre0[i - 1] + q;
  }
  if (negro == N) {
    cout << "0\n";
    return;
  }
  for (i = N; i > 0; i--) {
    p = q = 0;
    if (bin[i] == '#') {
      p = 1;
    } else {
      q = 1;
    }
    suf1[i] = suf1[i + 1] + p;
    suf0[i] = suf0[i + 1] + q;
  }
  for (i = 1; i <= N; i++) {
    p = pre0[i] + suf1[i + 1];
    q = pre1[i] + suf0[i + 1];
    res = min(res, q);
  }
  cout << res << "\n";
}
int main() {
  long long int i, t;
  t = 1;
  for (i = 1; i <= t; i++) {
    solve();
  }
}
