Count Duplicate Elements In Array Python Initialize Matrix