def count_true_positive(truth, recommend):
    """Count number of true positives from given sets of samples.

    Args:
        truth (numpy 1d array): Set of truth samples.
        recommend (numpy 1d array): Ordered set of recommended samples.

    Returns:
        int: Number of true positives.

    """
    tp = 0
    for r in recommend:
        if r in truth:
            tp += 1
    return tp