#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  reverse(s.begin(), s.end());
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    int white = s.find(".");
    string s2 = s.replace(0, white, white, 'A');
    int black = s.find("#");
    if (black < 0) {
      cout << 0 << endl;
      return 0;
    }
    if (n - black <= black - white) {
      ans.at(i) = n - black;
      break;
    } else {
      string s3 = s2.replace(0, black, black, 'B');
      int secondW = s3.find(".");
      if (secondW < 0) break;
      s = s3.replace(0, secondW, secondW, 'C');
      ans.at(i) = black - white;
    }
  }
  int ref = 0;
  for (int i = 0; i < n; i++) ref += ans.at(i);
  cout << ref << endl;
}
