@staticmethod
def d():
    (n, *ab) = map(int, sys.stdin.read().split())
    edges = [[] for _ in range(n)]
    for (a, b) in zip(*([iter(ab)] * 2)):
        a -= 1
        b -= 1
        edges[a].append(b)
        edges[b].append(a)
    parent = ([None] * n)

    def count(u):
        (black, white) = (1, 1)
        for v in edges[u]:
            if (v == parent[u]):
                continue
            parent[v] = u
            (b, w) = count(v)
            black *= w
            black %= MOD
            white *= ((b + w) % MOD)
            white %= MOD
        return (black, white)
    print((sum(count(0)) % MOD))
@staticmethod
def d():
    (n, *ab) = map(int, sys.stdin.read().split())
    edges = [[] for _ in range(n)]
    for (a, b) in zip(*([iter(ab)] * 2)):
        a -= 1
        b -= 1
        edges[a].append(b)
        edges[b].append(a)
    parent = ([None] * n)

    def count(u):
        (black, white) = (1, 1)
        for v in edges[u]:
            if (v == parent[u]):
                continue
            parent[v] = u
            (b, w) = count(v)
            black *= w
            black %= MOD
            white *= ((b + w) % MOD)
            white %= MOD
        return (black, white)
    print((sum(count(0)) % MOD))