#include using namespace std; int N, A[1000001], B[1000001], C[1000001], ans; int main() { // 入力 cin >> N; assert(1 <= N && N <= 1000000); for (int i = 1; i <= N; i++) { cin >> A[i]; assert(A[i] == 0 || A[i] == 1); } for (int i = 1; i <= N; i++) { cin >> B[i]; assert(B[i] == 0 || B[i] == 1); } // a_iとb_iが違う場合C_iを1にする for (int i = 1; i <= N; i++) { C[i] = A[i] ^ B[i]; } for (int i = 1; i <= N; i++) { if (C[i - 1] == 0 && C[i] == 1) { ans++; } } cout << ans << endl; return 0; }