
    Design an algorithm for a social event recommendation system that determines all possible ways to organize user interests into distinct recommendation clusters, where each interest can only belong to one cluster and all interests must be assigned. Given n different user interests, calculate the total number of unique ways these interests can be grouped into non-empty clusters to generate personalized event recommendations.
    

    
def bell_number(n):
    """
    Design an algorithm for a social event recommendation system that determines all possible ways to organize user interests into distinct recommendation clusters, where each interest can only belong to one cluster and all interests must be assigned. Given n different user interests, calculate the total number of unique ways these interests can be grouped into non-empty clusters to generate personalized event recommendations.
    

    """
def bell_number(n):
    """
    Design an algorithm for a social event recommendation system that determines all possible ways to organize user interests into distinct recommendation clusters, where each interest can only belong to one cluster and all interests must be assigned. Given n different user interests, calculate the total number of unique ways these interests can be grouped into non-empty clusters to generate personalized event recommendations.
    

    """
    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]