using System;
using System.Collections.Generic;
using System.IO;

namespace Contest
{
    class Program
    {
        private Scanner sc;
        private int N;
        private List<int>[] E, Child;
        private const long Mod = (long)1e9 + 7;
        private long[] W, B;
        private bool[] C;
        public void Solve()
        {
            sc = new Scanner();
            N = sc.NextInt();
            E = new List<int>[N];
            Child = new List<int>[N];
            for (int i = 0; i < N; i++)
            {
                E[i] = new List<int>();
                Child[i] = new List<int>();
            }

            for (int i = 0; i < N - 1; i++)
            {
                int x = sc.NextInt() - 1;
                int y = sc.NextInt() - 1;
                E[x].Add(y);
                E[y].Add(x);
            }
            W = new long[N];
            B = new long[N];
            C = new bool[N];
            for (int i = 0; i < N; i++)
            {
                W[i] = -1;
                B[i] = -1;
            }
            Calc(0);
            Console.WriteLine((White(0) + Black(0)) % Mod);
        }

        private void Calc(int i)
        {
            C[i] = true;
            foreach (var i1 in E[i])
            {
                if (C[i1]) continue;
                Child[i].Add(i1);
                Calc(i1);
            }

            C[i] = false;
        }

        // 0をroot iを白色
        private long White(int i)
        {
            if (W[i] != -1)
            {
                return W[i];
            }
            long res = 1;
            foreach (var i1 in Child[i])
            {
                res *= (White(i1) + Black(i1)) % Mod;
                res %= Mod;
            }
            W[i] = res;
            return res;
        }

        // 〃　黒色
        private long Black(int i)
        {
            if (B[i] != -1)
            {
                return B[i];
            }
            long res = 1;
            foreach (var i1 in Child[i])
            {
                res *= White(i1);
                res %= Mod;
            }
            B[i] = res;
            return res;
        }


        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 41956