#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
int main()
{
	int a;
	while(scanf("%d",&a)!=EOF)
	{
		string temp;
		cin >> temp;
		int count = 0;
		int count1[a] = {0};
		int count2[a] = {0};
		if(temp[0] == '#') count1[0] = 1;
		else               count2[0] = 1;
		for(int i=1; i<a; i++)
		{
			if(temp[i] == '#') count1[i]++;
			else               count2[i]++;
			count1[i] += count1[i-1];
			count2[i] += count2[i-1];
		}
		for(int i=0; i<a-1; i++)
		{
//			printf("%d\n",i);
			if(temp[i] == '#' && temp[i+1] == '.')
			{
				int count1 = 0, count2 = 0;
				for(int j=i; j>=0; j--)
				{
					if(temp[j] != '#') break;
					count1++;
				}
				for(int j=i+1; j<a; j++)
				{
					if(temp[j] != '.') break;
					count2++;
				}
				if(count1 > count2)
				{
					count += count2;
					i += count2;
				}
				else
				{
					count += count1;
				}
			}
		}
		printf("%d\n",count);
	}
	return 0;
}