QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#6245. Nouran

Estadísticas

The Faculty of Computer Engineering intends to decorate the faculty building for the ICPC contest. For this purpose, two strings of lamps have been prepared, each containing $n$ lamps. After the decorations are completed, the contest secretary is invited to visit the contest environment and give their opinion. During the visit, the secretary notices that the two strings are not identical in terms of which lamps are on or off at each position. Being very fond of symmetry, the secretary asks the person in charge of decorations to make both strings identical in terms of the on/off status of the lamps. While performing this task, the person in charge realizes that due to a technical problem, they cannot change the state of a single lamp individually. In each step, they must change the state of exactly two lamps simultaneously. Note that the two lamps do not necessarily have to belong to the same string, but in each step, two lamps must change their state simultaneously. Being heavily occupied with other matters, they have asked you to assist them in this task.

Input

The first line of the input contains the integer $n$, representing the number of lamps in each string. Each of the second and third lines contains a binary string of length $n$, representing the status of the lamps in each of the two strings. $0$ means the lamp is off, and $1$ means the lamp is on.

Output

If it is possible to make the strings identical under the given conditions, print the minimum number of steps required to make the strings identical. Otherwise, print NO.

Constraints

$1 \le n \le 10^6$

Examples

Input 1

5
00011
11011

Output 1

1

Input 2

7
0101010
1101100

Output 2

NO

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.