from datetime import datetime


def to_mins(timestamp: datetime):
    """
    Calculates n minutes from midnight.
    """
    delta = timestamp - datetime(timestamp.year, timestamp.month, timestamp.day)
    return delta.seconds // 60