n = int(input())
a = [input(), input()]
ans = 0
segments = 0
prv = -1
for i in range(n):
if a[0][i] == a[1][i]:
if a[0][i] == 'B':
ans += 1
else:
if prv == -1 or a[0][i] != a[0][prv]:
segments += 1
prv = i
if segments > 0:
ans += segments // 2 + 1
print(ans)