def tribonacci(n: int) -> int:
    """Calculate the Nth Tribonacci number."""
    f0: int = 0
    f1: int = 0
    f2: int = 1
    for _ in range(n):
        f0, f1, f2 = f1, f2, f0 + f1 + f2
    return f0