
    Given n distinct transaction patterns identified in a bank's fraud detection system, determine the total number of possible ways these patterns can be grouped into separate monitoring categories, where each pattern must belong to exactly one category and empty categories are not allowed. For example, if there are 3 suspicious transaction patterns, they could be monitored as one group of three patterns, or as two separate groups (with multiple possible arrangements), or as three individual groups, and the task is to calculate the total number of such possible grouping arrangements.
    

    
def bell_number(n):
    """
    Given n distinct transaction patterns identified in a bank's fraud detection system, determine the total number of possible ways these patterns can be grouped into separate monitoring categories, where each pattern must belong to exactly one category and empty categories are not allowed. For example, if there are 3 suspicious transaction patterns, they could be monitored as one group of three patterns, or as two separate groups (with multiple possible arrangements), or as three individual groups, and the task is to calculate the total number of such possible grouping arrangements.
    

    """
def bell_number(n):
    """
    Given n distinct transaction patterns identified in a bank's fraud detection system, determine the total number of possible ways these patterns can be grouped into separate monitoring categories, where each pattern must belong to exactly one category and empty categories are not allowed. For example, if there are 3 suspicious transaction patterns, they could be monitored as one group of three patterns, or as two separate groups (with multiple possible arrangements), or as three individual groups, and the task is to calculate the total number of such possible grouping arrangements.
    

    """
    bell = [[0 for i in range(n + 1)] for j in range(n + 1)]
    bell[0][0] = 1
    for i in range(1, n + 1):
        bell[i][0] = bell[i - 1][i - 1]
        for j in range(1, i + 1):
            bell[i][j] = bell[i - 1][j - 1] + bell[i][j - 1]
    return bell[n][0]