output_description: Print the number of ways in which the vertices can be painted, modulo 10^9 +
  7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      x_1 y_1
      x_2 y_2
      :
      x_{N - 1} y_{N - 1}
attempt: #!/usr/bin/env python3
  from collections import defaultdict, deque
  from heapq import heappush, heappop
  from bisect import bisect_left, bisect_right
  import sys, random, itertools, math
  
  sys.setrecursionlimit(10**5)
  input = sys.stdin.readline
  sqrt = math.sqrt
  
  
  def LI():
      return list(map(int, input().split()))
  
  
  def LF():
      return list(map(float, input().split()))
  
  
  def LI_():
      return list(map(lambda x: int(x) - 1, input().split()))
  
  
  def II():
      return int(input())
  
  
  def IF():
      return float(input())
  
  
  def LS():
      return list(map(list, input().split()))
  
  
  def S():
      return list(input().rstrip())
  
  
  def IR(n):
      return [II() for _ in range(n)]
  
  
  def LIR(n):
      return [LI() for _ in range(n)]
  
  
  def FR(n):
      return [IF() for _ in range(n)]
  
  
  def LFR(n):
      return [LI() for _ in range(n)]
  
  
  def LIR_(n):
      return [LI_() for _ in range(n)]
  
  
  def SR(n):
      return [S() for _ in range(n)]
  
  
  def LSR(n):
      return [LS() for _ in range(n)]
  
  
  mod = 1000000007
  inf = 1e10
  
  """
  URL: https://atcoder.jp/contests/dp/tasks/dp_p
  
  P - Independent Set / 
  実行時間制限: 2 sec / メモリ制限: 1024 MB
  
  配点 : 
  100 点
  
  問題文
  N 頂点の木があります。 
  頂点には 1,2,…,N と番号が振られています。
  各 i (1≤i≤N−1) について、i 番目の辺は頂点 xi と yi を結んでいます。
  
  太郎君は、各頂点を白または黒で塗ることにしました。 ただし、隣り合う頂点どうしをともに黒で塗ってはいけません。
  
  頂点の色の組合せは何通りでしょうか？ 
  10**9+7 で割った余りを求めてください。
  
  制約
  入力はすべて整数である。
  1≤N≤10**5
  1≤xi,yi≤N
  与えられるグラフは木である。
  
  """
  
  
  # solve
  def solve():
      n = II()
      edg = [[] for _ in range(n)]
      for _ in range(n - 1):
          x, y = LI_()
          edg[x].append(y)
          edg[y].append(x)
      black = [1] * n
      white = [1] * n
      rank = [-1] * n
      rank[0] = [0, None]
      q = deque()
      q.append([0, -1])
      while q:
          node, pre = q.pop()
          for nex in edg[node]:
              if nex == pre:
                  continue
              rank[nex] = [rank[node][0] + 1, node]
              q.appendleft((nex, node))
  
      ans = []
      for i in range(n):
          ans.append((-rank[i][0], rank[i][1], i))
      ans.sort()
      for _, i, j in ans[:-1]:
          black[i] *= white[j]
          white[i] *= white[j] + black[j]
          black[i] %= mod
          white[i] %= mod
      print((white[0] + black[0]) % mod)
      return
  
  
  # main
  if __name__ == "__main__":
      solve()
  
problem_description: Statement
  
  There is a tree with N vertices, numbered 1, 2, \ldots, N. For each i (1 \leq
  i \leq N - 1), the i-th edge connects Vertex x_i and y_i.
  
  Taro has decided to paint each vertex in white or black. Here, it is not
  allowed to paint two adjacent vertices both in black.
  
  Find the number of ways in which the vertices can be painted, modulo 10^9 + 7.
samples: [{"input": "3\n    1 2\n    2 3", "output": "5\n    \n\nThere are five ways to paint the vertices, as follows:\n\n![](https://img.atcoder.jp/dp/indep_0_muffet.png)\n\n* * *"}, {"input": "4\n    1 2\n    1 3\n    1 4", "output": "9\n    \n\nThere are nine ways to paint the vertices, as follows:\n\n![](https://img.atcoder.jp/dp/indep_1_muffet.png)\n\n* * *"}, {"input": "1", "output": "2\n    \n\n* * *"}, {"input": "10\n    8 5\n    10 8\n    6 5\n    1 5\n    4 8\n    2 10\n    3 6\n    9 2\n    1 7", "output": "157"}]