#d2740. 最长公共子序列
最长公共子序列
Longest Common Subsequence
Problem Description
You are given two permutations and of the numbers to . Find the length of their longest common subsequence.
Input Format
The first line contains a positive integer .
Each of the next two lines contains integers — a permutation of the natural numbers .
Output Format
Output one number: the length of the longest common subsequence.
Sample Input
5
3 2 1 4 5
2 1 3 4 5
Sample Output
4
Constraints