def min_operations_to_good_string(n, s): operations = 0 i = 0 while i < n - 1: # Only start checking if current char is '0' if s[i] == '0': count_0 = 1 count_1 = 0 j = i + 1 while j < n: if s[j] == '0': count_0 += 1 else: count_1 += 1 if count_0 > count_1: operations += 1 i = j + 1 # Skip over the violated segment break j += 1 else: break # No further violations else: i += 1 print(operations) if __name__ == "__main__": n = int(input()) s = input().strip() min_operations_to_good_string(n, s)