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