Language: C++

// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef DEBUG_MODE

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 200005
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
char S[MAX_N];
int prefix_white[MAX_N];
/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	//  WF("output.txt");
	DF("err.txt");
	
	int N;
	scanf("%d %s", &N, S);
	memset(prefix_white, 0, sizeof(prefix_white));
	if (S[0] == '.') prefix_white[0]++;
	for (int i = 1; i < N; i++) {
		prefix_white[i] = prefix_white[i - 1];
		if (S[i] == '.') prefix_white[i]++;
		eprintf("{%d}\n", prefix_white[i]);
	}
	int res = INT_MAX;
	for (int i = 0; i < N; i++) {
		int left_black = 0;
		if (i > 0) left_black = i - prefix_white[i - 1];
		int right_white = prefix_white[N - 1] - prefix_white[i];
		eprintf("%d => {%d %d}\n", i, left_black, right_white);
		res = min(res, left_black + right_white);
	}
	printf("%d\n", res);
	return 0;
}// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef DEBUG_MODE

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 200005
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
char S[MAX_N];
int prefix_white[MAX_N];
/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	//  WF("output.txt");
	DF("err.txt");
	
	int N;
	scanf("%d %s", &N, S);
	memset(prefix_white, 0, sizeof(prefix_white));
	if (S[0] == '.') prefix_white[0]++;
	for (int i = 1; i < N; i++) {
		prefix_white[i] = prefix_white[i - 1];
		if (S[i] == '.') prefix_white[i]++;
		//eprintf("{%d}\n", prefix_white[i]);
	}
	int res = INT_MAX;
	for (int i = 0; i < N; i++) {
		int left_black = 0;
		if (i > 0) left_black = i - prefix_white[i - 1];
		int right_white = prefix_white[N - 1] - prefix_white[i];
		//eprintf("%d => {%d %d}\n", i, left_black, right_white);
		res = min(res, left_black + right_white);
	}
	printf("%d\n", res);
	return 0;
}

Compiler output:
a.cc:133:14: error: redefinition of 'const double PI'
  133 | const double PI = acos(-1.0);
      |              ^~
a.cc:47:14: note: 'const double PI' previously defined here
   47 | const double PI = acos(-1.0);
      |              ^~
a.cc:134:14: error: redefinition of 'const double EPS'
  134 | const double EPS = 1e-6;
      |              ^~~
a.cc:48:14: note: 'const double EPS' previously defined here
   48 | const double EPS = 1e-6;
      |              ^~~
a.cc:146:6: error: redefinition of 'char S [200005]'
  146 | char S[MAX_N];
      |      ^
a.cc:60:6: note: 'char S [200005]' previously declared here
   60 | char S[MAX_N];
      |      ^
a.cc:147:5: error: redefinition of 'int prefix_white [200005]'
  147 | int prefix_white[MAX_N];
      |     ^~~~~~~~~~~~
a.cc:61:5: note: 'int prefix_white [200005]' previously declared here
   61 | int prefix_white[MAX_N];
      |     ^~~~~~~~~~~~
a.cc:149:5: error: redefinition of 'int main()'
  149 | int main() {
      |     ^~~~
a.cc:63:5: note: 'int main()' previously defined here
   63 | int main() {
      |     ^~~~