#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return a > b; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cont = 0;
  int izq[n];
  int der[n];
  cont = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '#')
      cont++;
    else {
      izq[i] = cont;
      cont = 0;
    }
  }
  cont = 1;
  for (int i = n - 2; i >= 0; --i) {
    if (s[i] == '.') {
      cont++;
    } else {
      der[i + 1] = cont;
      cont = 0;
    }
  }
  cont = 0;
  for (int i = 1; i < n; ++i) {
    if (s[i] == '.' && s[i - 1] == '#') {
      cont += min(izq[i], der[i]);
    }
  }
  cout << cont << "\n";
  return 0;
}
