#include <bits/stdc++.h>
using namespace std;
int a[2000005], b[2000005];
char s[2000005];
int main() {
  register int n;
  scanf("%d", &n);
  register long long cnt = 0;
  scanf("%s", &s);
  for (register int i = 1; i <= n; ++i) a[i] = s[i - 1] - '0';
  scanf("%s", &s);
  for (register int i = 1; i <= n; ++i) b[i] = s[i - 1] - '0';
  for (register int i = 1; i <= n; ++i) {
    if (b[i] && !a[i]) {
      if (a[i - 1] && !b[i - 1]) {
        ++cnt;
        swap(a[i - 1], a[i]);
      } else if (a[i + 1] && !b[i + 1]) {
        ++cnt;
        swap(a[i + 1], a[i]);
      } else {
        ++cnt, a[i] = 1;
      }
    }
  }
  for (register int i = 1; i <= n; ++i) {
    if (!b[i] && a[i]) ++cnt;
  }
  cout << cnt;
}
