#include <bits/stdc++.h>
using namespace std;
char VOW[] = {'a', 'e', 'u', 'o', 'i', 'A', 'E', 'U', 'O', 'I'};
int A[2 * 100000 + 2];
int B[2 * 100000 + 2];
int n;
string s;
void saitama() {
  cin >> n >> s;
  A[0] = (s[0] == '#');
  B[n - 1] = (s[n - 1] == '.');
  for (int i = 1; i < n; ++i) {
    if (s[i] == '#') {
      A[i] = A[i - 1] + 1;
    } else {
      A[i] = 0;
    }
  }
  for (int i = n - 2; i >= 0; --i) {
    if (s[i] == '.') {
      B[i] = B[i + 1] + 1;
    } else {
      B[i] = 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '.' && s[i - 1] == '#') {
      ans += min(A[i - 1], B[i]);
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  saitama();
  return 0;
}
