import java.util.Scanner; public class HelloWorld { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] ai = new int[n]; int[] bi = new int[n]; for (int i = 0; i < n; i++) { ai[i] = sc.nextInt(); } for (int i =0; i < n; i++) { bi[i]=sc.nextInt(); } sc.close(); int count = 0; for (int i = 0; i < n; i ++) { if (ai[i] != bi[i]) { for (int j = i; j < n; j ++) { if (ai[j] == bi[j]) { count ++; i = j; break; } if (j == n-1) { count ++; i = j ; break; } } } } System.out.println(count); }}