#include <bits/stdc++.h>
using namespace std;
int CalcSumOfDigit(int n);
int getDigit(int n);
string upper(string str);
string lower(string str);
vector<pair<long long, long long>> prime_factorize(long long p);
vector<pair<char, long long>> runLengthEncoding(string s);
class Combi {
 public:
  Combi();
  long long Combination(long long n, long long k);
  long long nPk_modp(long long n, long long k, long long p);

 private:
  map<long long, map<long long, long long>> memo;
  long long n_num;
  long long k_num;
};
const int INF = 1e9;
int main() {
  long long n;
  string s;
  cin >> n >> s;
  vector<long long> w(n + 1, 0), b(n + 1, 0);
  for (long long(i) = 0; (i) < (n); (i)++) {
    w[i + 1] = w[i] + (s[i] == '.' ? 1 : 0);
    b[i + 1] = b[i] + (s[i] == '#' ? 1 : 0);
  }
  long long ans = 0;
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == '#') continue;
    if (w[i] < b[i]) {
      ans++;
    } else {
      ans += b[i];
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
int getDigit(int n) {
  int i = 1;
  while (1) {
    n = n / 10;
    if (n == 1) break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n) {
  int s = 0;
  while (n) {
    s += n % 10;
    n = n / 10;
  }
  return s;
}
string upper(string str) {
  for (auto itr = str.begin(); itr != str.end(); itr++) {
    if (97 <= *itr && *itr <= 122) {
      *itr = *itr - 32;
    }
  }
  return str;
}
string lower(string str) {
  for (auto itr = str.begin(); itr != str.end(); itr++) {
    if (65 <= *itr && *itr <= 90) {
      *itr = *itr + 32;
    }
  }
  return str;
}
Combi::Combi() {
  n_num = -1;
  k_num = -1;
};
long long Combi::Combination(long long n, long long k) {
  long long ret;
  if (memo[n][k] != 0) {
    ret = memo[n][k];
  } else if (n == k || k == 0) {
    memo[n][k] = 1;
    ret = 1;
  } else {
    ret = Combination(n - 1, k - 1) + Combination(n - 1, k);
    memo[n][k] = ret;
  }
  return ret;
}
long long Combi::nPk_modp(long long n, long long k, long long p) {
  long long ans = 1;
  for (long long i = k; i <= n; i++) {
    ans = (ans * i) % p;
  }
  return ans;
};
vector<pair<long long, long long>> prime_factorize(long long p) {
  vector<pair<long long, long long>> ret;
  for (long long x = 2; x * x <= p; ++x) {
    if (p % x != 0) continue;
    long long num = 0;
    while (p % x == 0) {
      num++;
      p /= x;
    }
    ret.push_back(make_pair(x, num));
  }
  if (p != 1) ret.push_back(make_pair(p, 1));
  return ret;
}
vector<pair<char, long long>> runLengthEncoding(string s) {
  vector<pair<char, long long>> ret;
  for (long long i = 0; i < s.length(); i++) {
    char cur = s[i];
    long long cnt = 1;
    for (long long j = i + 1; j < s.length(); j++) {
      if (cur != s[j]) break;
      cnt++;
    }
    ret.emplace_back(make_pair(cur, cnt));
    i += cnt - 1;
  }
  return ret;
}
