def count_common_peaks(peaks):
    """Returns the number of common peaks."""
    n_common = 0
    for chrom in peaks.chroms:
        for peak in peaks.fetch(chrom):
            if peak.iscommon:
                n_common += 1
    return n_common