find how many elements are common in two array of length n