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

#include <unordered_map>

#include <unordered_set>

using namespace std;

#define endl '\n'

#define PI acos(-1)

typedef long long ll;

//	Table is the complete reverse of dp

//	Always think of the pattern (LCM, GCD)

//	Be careful of unsigned

//	double epsilon = FLT_EPSILON;

//	Think of a solution that gets TLE and optimize it

const int MOD = 1e9 + 7;

int n;

ll *dp[2];

vector<int>* ch;

int solve(int i = 0, bool col = 0, int last = n)

{

	ll &ret = dp[col][i];

	if(~ret)

		return ret;

	if((ch[i].size() == 1 && ch[i][0] == last) || ch[i].empty())

		return ret = !col + 1;

	if(col)

	{

		ret = 1;

		for(unsigned int j = 0; j < ch[i].size(); j++)

			if(ch[i][j] != last)

				ret = (ret * solve(ch[i][j], 0, i)) % MOD;

	}

	else

	{

		ll first = 1, second = 1;

		for(unsigned int j = 0; j < ch[i].size(); j++)

			if(ch[i][j] != last)

			{

				first = (first * solve(ch[i][j], 0, i)) % MOD;

				second = (second * solve(ch[i][j], 1, i)) % MOD;

			}

		ret = (first + second) % MOD;

	}

	return ret;

}

int main()

{

    cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false);

    cin >> n;

    ch = new vector<int>[n];

	dp[0] = new ll[n];

	dp[1] = new ll[n];

	memset(dp[0], -1, n * 8);

	memset(dp[1], -1, n * 8);

	int x, y;

	while(cin >> x >> y)

	{

		ch[x - 1].push_back(y - 1);

		ch[y - 1].push_back(x - 1);

	}

	cout << solve();

}