Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the least significant bit is stored in the first bit of the cell, the next significant bit is stored in the second bit, and so on; the most significant bit is stored in the n-th bit.

Now Sergey wants to test the following instruction: "add 1 to the value of the cell". As a result of the instruction, the integer that is written in the cell must be increased by one; if some of the most significant bits of the resulting number do not fit into the cell, they must be discarded.

Sergey wrote certain values ​​of the bits in the cell and is going to add one to its value. How many bits of the cell will change after the operation?


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 100) — the number of bits in the cell.

The second line contains a string consisting of n characters — the initial state of the cell. The first character denotes the state of the first bit of the cell. The second character denotes the second least significant bit and so on. The last character denotes the state of the most significant bit.


-----Output-----

Print a single integer — the number of bits in the cell which change their state after we add 1 to the cell.


-----Examples-----
Input
4
1100

Output
3

Input
4
1111

Output
4



-----Note-----

In the first sample the cell ends up with value 0010, in the second sample — with 0000.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
k = input()
amount = 0
for elem in k:
    amount += 1
    if elem == '0':
        break
print(amount)

# Codeforces 265 Div. 2
# A

n = int(input())
l = list(input())
c = 0

for x in l:
    if int(x) == 0:
        c += 1
        break
    else:
        c += 1

print(c)


import sys

def main():
    # fin = open("input.txt", "r")
    fin = sys.stdin
    fout = sys.stdout

    n = int(fin.readline())
    s = list(fin.readline())

    i = 0
    while i < n and s[i] == '1':
        i += 1

    print(min(i + 1, n))


main()

n = input()
s = input()
result = 0
for c in s:
    if c == "1":
        result += 1
    else:
        result += 1
        break
print(result)

n = int(input())
a = list(map(int, list(input().strip())))
cnt = 0
now = 1
for i in range(n):
    if now:
        cnt += 1
        now = a[i] % 2
        a[i] += 1
        a[i] %= 2
print(cnt)

x = int(input())
cell = input()
cell2 = ''
for i in cell:
    cell2 = i + cell2 
cell3 = bin(int(cell2, 2)+1)
cell4 = cell3[2:]
cell5='0'*(x-len(cell4))
for i in cell4:
    cell5 = i + cell5 
cell6 = cell5[:x]
sa=0
for i in range(x):
    if cell6[i] != cell[i]:
        sa+=1
print(sa)


n = int(input())
m = str(input())
j = 0
while j < n and m[j] == '1':
    j += 1
if j < n:
    print(j + 1)
else:
    print(n)



w=int(input())
x = int(input()[::-1], 2)
y=(x+1)%2**w
print(bin(y^x).count("1"))


#!/usr/bin/env python3

def main():
    n = input()
    s = list(map(int, input()))
    t = list(s)
    c = 1
    for i in range(len(t)):
        if c == 0:
            break
        t[i] += 1
        if t[i] == 2:
            t[i] = 0
            c = 1
        else:
            c = 0
    res = 0
    for i in range(len(t)):
        res += (t[i] != s[i])
    print(res)

def __starting_point():
    main()

__starting_point()

n=int(input())
s=input()
v=list(int(x) for x in s)
c=0
for i in range(len(v)):
    c+=1
    if not v[i]:
        break
print(c)


n = int(input())
s = input()
swaps = 0
k = 0
for i in range(len(s)):
    if int(s[i]) == 0:
        k += 1
        break
    k += 1
print(k)


n, cell, i = int(input()), list(map(int, input().strip())), 0
while i < n - 1 and cell[i]:
    i += 1
print(i + 1)


n=input()
s=input()
i=1
if n=='1':
	print(1)
else:
	while s[i-1]=='1':
		i+=1
		if i>=len(s):
			break
	print(i)

n = int(input())
s = input()

c = 0
if s[0] == '0' :
    c = 1
else:

    for i in range(n):
        if s[i] == '0':
            c += 1
            break
        else:
            c += 1
print(c)
    


#input
n=int(input())
cell=str(input())

#variables

#main
if '0' in cell:
	print(cell.index('0')+1)
else:
	print(n)

n = int(input())
s = input()
i = 0
while i < n and s[i] == '1':
    i += 1
if i < n:
    print(i+1)
else:
    print(i)

n = int(input())
m = int(input()[::-1], 2)
l = ((m + 1) & ((1 << n) - 1))
res = 0
for i in range(n):
	if ((m&1) != (l&1)): res += 1
	l >>= 1
	m >>= 1
print(res)

n = int(input())
ar = input()
ind = 0
s = 0
for i in ar:
    if i == '1' and ind == 0:
        s += 1
    else:
        ind = 1
if s < len(ar):
    print(s + 1)
else:
    print(len(ar))

import math

n = int(input())
str = input()

res = ['' for i in range(n)]
b = True
for i in range(n):
    if str[i] == '0':
        res[i] = '1'
        for j in range(i):
            res[j] = '0'
        b = False

        for j in range(i+1, n):
            res[j] = str[j]

        break


if b:
    print(n)
else:
    total = 0
    for i in range(n):
        if res[i]!=str[i]:
            total+=1
    print(total)

input()
x = input()
a = 1
for i in range(len(x)):
    if x[i] == '0':
        break
    else:
        a += 1
    if i == (len(x)-1):
        a -= 1        
    
print(a)

n=int(input())
cell=input()
ans=1
i=0
if cell[i]=='1':
    while i<n-1 and cell[i+1]=='1':
        ans+=1
        i+=1
    if i<n-1:
        ans+=1
print(ans)

n = int(input())
box = input()
ans = 1
if box[0] == '0':
    pass
else:
    for bit in box:
        if bit == '1':
            ans += 1
        else:
            break
print(min(ans, n))

N = int(input())
S = input()[::-1]
x = int(S, 2) + 1
Sp = bin(x)[2:].zfill(N)[-N:]
print(sum(a != b for a, b in zip(S, Sp)))


n = int(input())
bits = input()
x = int(bits[::-1], 2)
x += 1
if x == 2 ** n:
    x = 0
t = bin(x)[2:]
bits2 = ('0' * (n - len(t)) + t)[::-1]
cnt = 0
for i in range(n):
    if bits[i] != bits2[i]:
        cnt += 1
print(cnt)

def solve():
    n=int(input())
    ans=0
    k=input()
    p=1
    if k[0]=='0':
        ans+=1
        print(ans)
    else:
        for i in range(n):
            if p==0:
                break
            else:
                if k[i]=='0':
                    k=k[:i]+'1'+k[i+1:]
                    ans+=1
                    p=0
                else:
                    k=k[:i]+'0'+k[i+1:]
                    ans+=1
        print(ans)
solve()