#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    
    bool msrng = true;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && msrng) {
            msrng = false;
            cnt++;
        }
        else if (a[i] != b[i] && !msrng) {
            msrng = true;
        }
    }
    if (msrng) cnt++;
    cout << cnt << endl;
}