#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {
    1,
    -1,
    0,
    0,
};
long long X, Y, Z, K;
long long pmax = 30000000000;
vector<long long> A, B, C;
int main() {
  long long N;
  string S;
  cin >> N;
  cin >> S;
  long long w = 0;
  long long b = 0;
  long long wtemp = 0;
  long long btemp = 0;
  for (long long i = 0; i < N; i++) {
    if (S[i] == '#') {
      wtemp++;
    } else {
      w += wtemp;
      wtemp = 0;
    }
    if (S[N - 1 - i] == '.') {
      btemp++;
    } else {
      b += btemp;
      btemp = 0;
    }
  }
  cout << min(w, b) << endl;
}
