Two sequences of integers are given. Find the length of their longest common subsequence (the subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements).
First line contains the length of the first sequence. Second line contains elements of the first sequence — integers no more than by absolute value. Third line contains the length of the second sequence . Fourth line contains elements of the second sequence — integers no more than by absolute value.
Print the length of the longest common subsequence, or if it does not exist.