// Slower C++ solution:
#include <bits/stdc++.h>                                           

 

//#define int long long

//#pragma GCC optimize("Ofast")

//#pragma comment(linker, "/stack:200000000")

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

 

 

#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);

#define forev(i, b, a) for(int i = (b); i >= (a); --i)

#define forn(i, a, b) for(int i = (a); i <= (b); ++i)

#define all(x) x.begin(), x.end()

#define sz(s) (int)s.size()

#define pb push_back

#define ppb pop_back

#define s second

#define f first

 

 

using namespace std;

 

 

typedef pair < long long, long long > pll;    

typedef pair < int, int > pii;

typedef unsigned long long ull;         

typedef vector < pii > vpii;

typedef vector < int > vi;

typedef long double ldb;  

typedef long long ll;  

typedef double db;                      

 

 

const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e5 + 11;

const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;

const pii base = {1171, 3307}, Mod = {1e9 + 7, 1e9 + 9};

const db eps = 1e-12, pi = 3.14159265359;

const ll INF = 1e18;





int n, v, u, dp[N][2];

vi g[N];





void dfs (int v, int p = 0) {

	dp[v][0] = 1;

	dp[v][1] = 1;



	for (auto to : g[v])

		if (to != p) {

			dfs(to, v);

			dp[v][0] = dp[v][0] * 1ll * dp[to][1] % mod;

			dp[v][1] = dp[v][1] * 1ll * (dp[to][0] + dp[to][1]) % mod;

		}

}





main () {

	cin >> n;

	forn (i, 1, n - 1) {

		cin >> v >> u;

		g[v].pb(u);

		g[u].pb(v);

	}



	dfs(1);

	cout << (dp[1][0] + dp[1][1]) % mod;

}



    

// Faster C++ solution for the same problem (measured speedup: 2.5395025037949024x):
/*

    if you can't see the repay

    Why not just work step by step

    rubbish is relaxed

    to ljq

*/

#include <cstdio>

#include <cstring>

#include <iostream>

#include <queue>

#include <cmath>

#include <map>

#include <stack>

#include <set>

#include <sstream>

#include <vector>

#include <stdlib.h>

#include <algorithm>

using namespace std;

typedef long long ll;

const ll mod =  (int)1e9+7;

const int MAX_N = 100025;

int eid,p[MAX_N];

ll dp[MAX_N][2];

struct edge

{

    int v,next;

}e[MAX_N<<2];

void init()

{

    memset(p,-1,sizeof(p));

    eid = 0;

}

void add(int u,int v)

{

    e[eid].v = v;

    e[eid].next =p[u];

    p[u] = eid++;

}

void dfs(int u,int fa)

{

    ll x = 1, y = 1;

    if(e[p[u]].next==-1&&e[p[u]].v == fa)

    {

        dp[u][0] = dp[u][1] = 1;

        return ;

    }

    for(int i = p[u];i+1;i=e[i].next)

    {

        int v = e[i].v;

        if(v==fa) continue;

        dfs(v,u);

        x = (x*((dp[v][0] + dp[v][1])%mod))%mod;

        y = (y*(dp[v][0]))%mod;

    }

    dp[u][0] = x,dp[u][1] = y;

}

int main()

{

    //ios::sync_with_stdio(false);

    //freopen("a.txt","r",stdin);

    //freopen("b.txt","w",stdout);

    int n,a,b;

    init();

    scanf("%d",&n);

    for(int i = 1;i<n;++i)

    {

        scanf("%d%d",&a,&b);

        add(a,b);

        add(b,a);

    }

    dfs(1,0);

    printf("%d\n",(dp[1][0]+dp[1][1])%mod);

    //fclose(stdin);

    //fclose(stdout);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;

    return 0;

}