Create a program in Python to compare the elements of two given arrays and return the number of matches.
arr1 = [1, 2, 3]
arr2 = [3, 4, 5]
def count_matches(arr1, arr2):
    count = 0
    for i in arr1:
        if i in arr2:
            count += 1
    return count

print(count_matches(arr1, arr2))