// Slower C++ solution:
//#pragma GCC target ("avx2,sse2")

//#pragma GCC optimization ("Ofast")

//#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;



#define ordered_set tree <pair <ll, int>, null_type, less <pair <ll, int> >, rb_tree_tag, tree_order_statistics_node_update>

#define ll long long

#define ull unsigned long long

#define db double

#define pb push_back

#define pf push_front

#define ppb pop_back

#define ppf pop_front

#define fi first

#define se second

#define mp make_pair

#define up_b upper_bound

#define low_b lower_bound

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

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

#define endl "\n"



#define left fsdsdfoisf

#define sum dpsdfioppsf

#define assign xcvjlkdjfio

#define trie fksdfkjkfnjuiv

#define next sidlfjsfkl

#define merge sdfksdkfsldf



#define int long long



using namespace std;



void dout() {

    cerr << endl;

}

template <typename Head, typename... Tail>

void dout(Head H, Tail... T) {

    cerr << H << ' ';

    dout(T...);

}



//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair <int, int> pii;



const int N = 1e5 + 7, MOD = 1e9 + 7;

int n, dp[2][N];

vector <int> q[N];



void dfs(int v, int p) {

    int child = 0, A = 1, B = 1;

    for (auto i : q[v]) {

        if (i == p) {

            continue;

        }

        dfs(i, v);

        A = A * (dp[0][i] + dp[1][i]) % MOD;

        B = B * dp[0][i] % MOD;

        child++;

    }

    if (child == 0) {

        dp[0][v] = dp[1][v] = 1;

        return;

    }

    dp[0][v] = A;

    dp[1][v] = B;

}



void solve(int tc) {

    // check for (int i = 0; i < n; j++)

    cin >> n;

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

        int x, y;

        cin >> x >> y;

        q[x].pb(y);

        q[y].pb(x);

    }

    dfs(1, 1);

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

}



signed main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

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

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

    int tc = 1;

//    cin >> tc;

    for (int i = 0; i < tc; i++) {

        solve(i);

//        cleanup();

    }

}


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

    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;

}