Memory Bit Electrode Operations

No attempts yetTime limit1sMemory limit128 MB

Problem

In his Computer Systems Architecture class, Pawel built a new model of main memory that supports fast bit operations. In this model, the memory is a single binary string: one row of 0s and 1s.

You change the memory with a special electrode. The electrode first picks a single bit and a direction (left or right). Then, starting from the chosen bit and moving in that direction, it negates every bit it passes until it reaches the end (right) or the beginning (left) of the memory.

For example, if the memory is 0010 and you pick the second bit with the right direction, every bit from the second to the last is negated and the memory becomes 0101: the second bit changes from 0 to 1, the third from 1 to 0, and the fourth from 0 to 1.

Given the starting memory content and the target memory content, find the minimum number of operations needed to turn the start into the target.

Input

The first line contains an integer nn (1n106)(1 \le n \le 10^6).

The second line contains a binary string of length nn: the starting memory content.

The third line contains a binary string of length nn: the target memory content.

Output

Print, on a single line, the minimum number of operations needed to turn the starting content into the target content.

Hint

Below is one way to turn 10010000 into 00100111 in just 4 operations. The range in parentheses on each line is the bit segment negated by that operation.

  • 1001000001100000 (negate bits 1 to 4)
  • 0110000010100000 (negate bits 1 to 2)
  • 1010000000100000 (negate bit 1)
  • 0010000000100111 (negate bits 6 to 8)