#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e+17;
const long long MODcdf = 998244353;
bool pairCompare(const pair<long long, long long>& firstElof,
                 const pair<long long, long long>& secondElof) {
  return firstElof.first < secondElof.first;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> num;
  vector<bool> color;
  long long st = 0;
  bool judge;
  for (long long i = 0; i < n - 1; i++) {
    if (s[i] != s[i + 1]) {
      num.push_back(i + 1 - st);
      judge = (s[i] == '#') ? 1 : 0;
      color.push_back(judge);
      st = i + 1;
    }
  }
  num.push_back(n - st);
  judge = (s[n - 1] == '#') ? 1 : 0;
  color.push_back(judge);
  long long ans = 0;
  long long i = 0, j = n - 1;
  while (1) {
    if (!color[i]) i++;
    if (color[j]) j--;
    if (num[i] > num[j]) {
      ans += num[j];
      j--;
    } else {
      ans += num[i];
      i++;
    }
    if (j == i) break;
  }
  cout << ans << endl;
}
