#include <bits/stdc++.h>
using namespace std;
struct Fast {
  Fast() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
  }
} fast;
int main(void) {
  long long result = 0;
  long long N;
  string S;
  cin >> N >> S;
  long long x = 0, y = 0;
  bool flag = false;
  for (long long i = 0; i < (int)(S.size()); i++) {
    cout << x << ", " << y << ", " << result << endl;
    if (S[i] == '#') {
      if (flag) {
        if (x <= y) {
          result += x;
          x = 0;
        } else {
          result += y;
          x += y;
        }
        y = 0;
        flag = false;
      }
      x++;
    } else {
      y++;
      flag = true;
    }
  }
  if (flag) {
    if (x < y) {
      result += x;
    } else {
      result += y;
    }
  }
  cout << result << endl;
  return 0;
}
