from collections import deque import sys input = sys.stdin.readline MOD = 10 ** 9 + 7 n = int(input()) root = set(range(n)) edges = [[] for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) edges[a - 1].append(b - 1) root.remove(b - 1) for s in root: break queue = deque() queue.append(s) lst = [] while queue: pos = queue.popleft() lst.append(pos) for npos in edges[pos]: queue.append(npos) dp = [0] * n cnt = [0] * n for pos in lst[::-1]: cnt[pos] = 1 for npos in edges[pos]: dp[pos] += dp[npos] + cnt[npos] cnt[pos] += cnt[npos] dp[pos] %= MOD cnt[pos] %= MOD print(sum(dp) % MOD)