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: ######################################################
  ############Created by Devesh Kumar###################
  #############devesh1102@gmail.com####################
  ##########For CodeForces(Devesh1102)#################
  #####################2020#############################
  ######################################################
  import sys
  
  input = sys.stdin.readline
  
  # import sys
  import heapq
  import copy
  import math
  import decimal
  
  # import sys.stdout.flush as flush
  # from decimal import *
  # heapq.heapify(li)
  #
  # heapq.heappush(li,4)
  #
  # heapq.heappop(li)
  #
  # &	Bitwise AND Operator	10 & 7 = 2
  # |	Bitwise OR Operator	10 | 7 = 15
  # ^	Bitwise XOR Operator	10 ^ 7 = 13
  
  # <<	Bitwise Left Shift operator	10<<2 = 40
  # >>	Bitwise Right Shift Operator
  # '''############ ---- Input Functions ---- #######Start#####'''
  
  
  def inp():
      return int(input())
  
  
  def inlt():
      return list(map(int, input().split()))
  
  
  def insr():
      s = input()
      return list(s[: len(s) - 1])
  
  
  def insr2():
      s = input()
      return s[: len(s) - 1]
  
  
  def invr():
      return map(int, input().split())
  
  
  ############ ---- Input Functions ---- #######End
  # #####
  
  
  def pr_list(a):
      print(*a, sep=" ")
  
  
  def main():
      # tests =  inp()
      tests = 1
      mod = 1000000007
      limit = 10**18
      ans = 0
      start = {}
  
      def pre_sum(arr):
          ans = [arr[0]]
          for i in range(1, len(arr)):
              ans.append(ans[-1] + arr[i])
          return ans
  
      for test in range(tests):
          n = inp()
          branch = {}
  
          # parent = [0 for i in range(n+1)]
          for i in range(n - 1):
              [p, r] = inlt()
              if p in branch:
                  branch[p].append(r)
              else:
                  branch[p] = [r]
              if r in branch:
                  branch[r].append(p)
              else:
                  branch[r] = [p]
          parent = [-1 for i in range(n + 1)]
          # print(branch)
          # print(parent)
          # print(branch)
  
          dp = [[0 for j in range(n + 1)] for i in range(2)]
          leaf = {}
          ans = 2
          stack = [1]
          parent[1] = 0
          if n == 1:
              print(2)
              continue
          while stack != []:
              # print(stack)
              curr = stack[-1]
              flag = 0
              for i in branch[curr]:
                  if parent[i] == -1:
                      parent[i] = curr
                      stack.append(i)
                      flag = 1
              if flag == 0:
                  curr = stack.pop()
                  white = 1
                  black = 1
                  for i in branch[curr]:
                      if i != parent[curr]:
                          white = (white * (dp[0][i] + dp[1][i])) % mod
                          black = (black * (dp[0][i])) % mod
                  dp[0][curr] = white
                  dp[1][curr] = black
  
          print((dp[0][1] + dp[1][1]) % mod)
  
          # for i in range(1,n+1):
          # 	if i not in branch:
          # 		leaf[i] = 1
          # 		dp[0][i] =1
          # 		dp[1][i] =1
          # # print(leaf)
          # while(leaf!={}):
          # 	nexts = {}
          # 	for i in leaf:
          # 		nexts[parent[i]] = 1
          # 	# print(nexts)
          # 	if 0 in nexts:
          # 		del nexts[0]
          # 	for i in nexts:
          # 		white = 1
          # 		black = 1
  
          # 		for j in branch[i]:
          # 			white = white*(dp[0][j] + dp[1][j])
          # 			black = black * dp[1][j]##1 is white
          # 		dp[0][i] = black
          # 		dp[1][i] = white
          # 		ans= max(ans, dp[0][i]+dp[1][i])
          # 	leaf = nexts
          # print(ans)
  
  
  if __name__ == "__main__":
      main()
  
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"}]