// 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: 3.4998738836614134x):
#include <bits/stdc++.h>



#define forn(i, n) for (int i = 0; i < int(n); ++i)

#define for1(i, n) for (int i = 1; i <= int(n); ++i)

#define F first

#define S second

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

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

#define pb push_back



using namespace std;

using ll=long long;

using pii= pair<int, int>;

mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());

template<typename... T> void rd(T&... args) {((cin>>args), ...);}

template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}



vector<vector<int>> G;

vector<array<ll,2>> dp;

const int mod=1e9+7;

void dfs(int u,int fa){

    for(auto to:G[u]){

        if(to==fa) continue;

        dfs(to,u);

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

        (dp[u][1]*=dp[to][0])%=mod;

    }

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int n;

    cin>>n;

    if(n==1) return cout<<2,0;

    G.resize(n+1);

    dp.resize(n+1,{1,1});

    forn(i,n-1){

        int x,y;

        cin>>x>>y;

        G[x].pb(y);

        G[y].pb(x);

    }

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

        if(sz(G[i])==1) dp[i][1]=dp[i][0]=1;

    dfs(1,0);

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

    return 0;

}