#include <bits/stdc++.h>
int main() {
  int n;
  char stone[100000] = {};
  scanf(" %d", &n);
  scanf(" %s", stone);
  int i = 0;
  int ans = 0;
  int ans2 = 0;
  int ch = 0;
  for (i = 0;; i++) {
    if (stone[i] == '#') {
      ans += ch;
    } else
      ch++;
    if (stone[i] == '\0') break;
  }
  ch = 0;
  for (i = 0;; i++) {
    if (stone[i] == '.') {
      ans2 += ch;
    } else
      ch++;
    if (stone[i] == '\0') break;
  }
  if (ans > ans2)
    printf("%d\n", ans2);
  else
    printf("%d\n", ans);
  return 0;
}
