#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  string s;
  cin >> N;
  cin >> s;
  long a = 0;
  int flag = 0;
  int inflag = 0;
  int chflag = 0;
  long tmp = 0;
  long b = 0;
  long b_r = 0;
  long a_r = 0;
  for (long i = 0; i < N; i++) {
    if (s[i] == '#' && flag == 0) {
      flag = 1;
    }
    if (flag == 1) {
      if (s[i] == '.') {
        inflag = 1;
        a++;
      } else {
        if (inflag == 0) {
          b++;
        } else {
          tmp = b;
          chflag = 1;
        }
      }
      if (chflag == 1 || i == N - 1) {
        if (b <= a) {
          b_r = b_r + b;
        } else {
          a_r = a_r + a;
        }
        chflag = 0;
        inflag = 0;
        a = 0;
        b = tmp;
      }
    }
  }
  a_r = a_r + b_r;
  if (a_r == N || a_r == 0) {
    cout << '0' << endl;
  } else {
    cout << a_r << endl;
  }
  return 0;
}
