import math


def _map_tile_count(map_size: int, lod: int) -> int:
    """Return the number of map tiles for the given map.

    Args:
        map_size (int): The base map size in map units
        lod (int): The LOD level for which to calculate the tile count

    Returns:
        int: The number of tiles in the given map's tile grid

    """
    return math.ceil(4 ** (int(math.log2(map_size)) - 8 - lod))