#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INF = 1e9;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int w = 0, b = 0, ans = 0;
  for (int i = 0; i < N; ++i) {
    if (S[i] == '#')
      b++;
    else
      w++;
    ans = max(ans, abs(w - b));
  }
  if (ans == N)
    cout << 0;
  else
    cout << ans;
  cout << endl;
  return 0;
}
