#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VII;
template <class T, class U>
bool chmax(T& map<int, int> MP;, U b) {
  if (map<int, int> MP; < b) {
    map<int, int> MP;
    = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T& map<int, int> MP;, U b) {
  if (map<int, int> MP; > b) {
    map<int, int> MP;
    = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  os << "{";
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << (i < v.size() - 1 ? ", " : "");
  }
  os << "}";
  return os;
}
template <typename T>
T gcd(T map<int, int> MP;, T b) {
  return b != 0 ? gcd(b, map<int, int> MP; % b) : map<int, int> MP;
  ;
}
template <typename T>
T lcm(T map<int, int> MP;, T b) {
  return map<int, int> MP;
  / gcd(map<int, int> MP;, b) * b;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
int main() {
  ll x = 0, y = 0, z = 0, n, m = 0, k, ans = 0, h, w, sum = 0, Max = -1e9 - 1,
     cnt = 0, Min = 1e9 + 1;
  string s, t, u;
  bool ok = false;
  cin >> n >> s;
  vector<long long> map<int, int> MP;
  (n);
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      ok = true;
      if (i == n - 1) {
        map<int, int> MP;
        [x] = cnt;
      }
      continue;
    }
    if (ok) {
      if (s[i] == '.') {
        cnt++;
        if (i == n - 1) {
          map<int, int> MP;
          [x] = cnt;
        }
      } else {
        map<int, int> MP;
        [x] = cnt;
        x++;
        cnt = 0;
        ok = false;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    ans += map<int, int> MP;
    [i];
  }
  cout << ans << endl;
  return 0;
}
