n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) cnt = 0 i = 0 j = 0 while i < n: while i < n and a[i] == b[i]: i += 1 if i == n: break j = i+1 while j < n and a[j] != b[j]: j += 1 i = j cnt += 1 print(cnt)