lampice | 프로그래밍의 벗 PivotOJ
PivotOJ

lampice

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2006 Regional Competition - SeniorsBOJ 3159

문제

2*N light bulbs are arranged in two rows and N columns. Each light bulb can be either off or on, and all lights are initially off. 

We want to turn some of them on so that they form a beautiful pattern. In one step we can change the state of a sequence of (one or more) consecutive light bulbs in the same row or column. 

Given the desired pattern, write a program that finds the minimum number of steps required to form the pattern. 

입력

The first line of input contains an integer N, 1 ≤ N ≤ 10,000, the number of columns. 

Each of the following two lines contains a sequence of N characters representing the desired final pattern. 

Character '1' indicates a light bulb that should be on in the final state, while the character '0' indicates a light bulb that should be off. 

출력

The first and only line of output should contain a single integer – the minimum number of steps required. 

예제

예제 1

입력
3
100
000
출력
1

예제 2

입력
5
11011
11011
출력
3

예제 3

입력
20
11101101111000101010
01111101100000010100
출력
7
코드를 제출하려면 로그인하세요.