using System;
using System.Collections.Generic;
using System.Linq;


namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            char before = '.';
            int count = 0;
            var list = new List<int>();
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] != before)
                {
                    before = S[i];
                    list.Add(count);
                    count = 1;
                }
                else count++;
            }

            if (count != 0) list.Add(count);

            if (list.Count == 1)
            {
                Console.WriteLine(0);
                return;
            }

            int left = 0, right = 0;
            for (int i = 0; i < list.Count; i += 2)
            {
                right += list[i];
            }

            var counts = new List<int>();

            for (int i = 1; i < list.Count; i += 2)
            {
                counts.Add(left + right);
                left += list[i];
                right -= list[i - 1];
            }

            counts.Add(left + right);
            Console.WriteLine(counts.Min());
        }
    }

    static class EnumerableExtension
    {
        public delegate void Function<in T>(T val);

        public static void ForEach<T>(this IEnumerable<T> enumerable, Function<T> function)
        {
            foreach (var x in enumerable)
            {
                function(x);
            }
        }
    }
}