def get_n_regions(grid_enc):
    """ Get the number of regions encoded by compress_background_smartgrid().

    Parameters
    ----------
    grid_enc: dict
        Output from compress_background_smartgrid()
    
    Returns
    -------
    int
        Number of regions encoded
    """
    regions = 0
    for row in grid_enc.keys():
        if row == "shape":
            continue
        
        regions += len(grid_enc[row])
    
    return regions