#include <bits/stdc++.h>
using namespace std;
int n, i, o, j, a[1000005], m;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> s1 >> s2;
  for (i = 0; i < n; ++i)
    if (s1[i] == '1' && s2[i] == '0') a[++m] = i;
  a[++m] = n * 10;
  j = 1;
  for (i = 0; i < n; ++i)
    if (s2[i] == '1' && s1[i] == '0') {
      while (j < m && abs(a[j + 1] - i) < abs(a[j] - i)) {
        ++o;
        ++j;
      }
      if (j < m && abs(a[j] - i) == 1) {
        ++o;
        ++j;
      } else
        ++o;
    }
  while (j < m) {
    ++j;
    ++o;
  }
  cout << o;
  return 0;
}
