import math


def combination_num(n, r):
    """Combination formula to calculate the maximum amount of different combinations
    "n choose r"
    :param
        n (int) : n distict objects
        r (int) : sample of r elements

    :return
        Returns result of combination calculation"""
    if n < r:
        raise Exception('n cannot be less than r')
    if n == 0 or r == 0:
        raise Exception('n or r cannot be 0')
    return math.factorial(n) / (math.factorial(r) * math.factorial(n - r))