Count the number of files with only the partial file name

I have 1800 files in a directory. The file name is like out_cpty_XXXX. The "XXXX" vaires from file to file. I want to get the count of files with file name out_cpty_XXXX. How to get the count with just the partial file name?

Any help would be appreciated?

ls out_cpty_* | wc -l

Thanks Sandholm! that works

I have another question:

  1. Directory "A" has files like
    out_cpty_123; out_cpty_456; out_cpty_789....upto 1800 files
    out_pstn_123; out_pstn_456; out_pstn_789....upto 50000 files

  2. Directory "B" also the same files like above

I want to compare out_cpt_123 from both directories. Likewise each file from directory A should be compared with the like files from directory B.
Any help would be appreciated.

Thanks!

Basic solution here, but what to compare ? File exist ?

#!/usr/bin/ksh
dirA="some"
dirB="some/other"

compare()
{
    f1=$1
    f2=$2
    [ ! -f "$f2" ] && echo "not exist $f2" && return
    echo "$f2 exist"
    # comparing - what ?
} 
######
cd $dirA
for f in  out*
do
      compare "$f"  "$dirB/$f"
done

Thanks Kshji!

Each file has 14 columns and expected to have around 500 rows. Taking two column values as key identifier, need to compare the values in each cell.