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

using namespace std;

using ll = long long;

#define ris return *this

template<class c> struct rge {

	c b, e;

};

template<class c> rge<c> range(c i, c j) {

	return rge<c>{i, j};

}

template<class c> auto dud(c* x) -> decltype(cerr << *x, 0);

template<class c> char dud(...);

struct debug {

#ifdef LOCAL

	~debug() {

		cerr << endl;

	}

	template<class c> typename

		enable_if<sizeof dud<c>(0) != 1, debug&>::type operator << (c i) {

			cerr << boolalpha << i;

			ris;

		}

	template<class c> typename

		enable_if<sizeof dud<c>(0) == 1, debug&>::type operator << (c i) {

			ris << range(begin(i), end(i));

		}

	template<class c, class b> debug & operator << (pair <b, c> d) {

		ris << "(" << d.first << ", " << d.second << ")";

	}

	template<class c> debug & operator << (rge<c> d) {

		*this << "[";

		for (auto it = d.b; it != d.e; ++it)

			*this << ", " + 2 * (it == d.b) << *it;

		ris << "]";

	}

#else

	template<class c> debug & operator << (const c&) {

		ris;

	}

#endif

};

#define imie(...) " [" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "

const ll mod = 1e9 + 7;

const ll inf = 1e18;

const double pi = acos(-1.0);

const double eps = 1e-10;



template<typename T>

void s_max(T& a, T b) {

	if (b > a)

		a = b;

}



template<typename T>

void s_min(T& a, T b) {

	if (b < a)

		a = b;

}



template<typename T>

void s_add(T& a, T b) {

	a += b;

}



template<typename T>

void s_madd(T& a, T b) {

	a = (a + b) % mod;

}



const int N = 1e5 + 5;

int n;

vector<int> adj[N];

ll dp[N][2];



ll solve(int v, int p, int c) {

	if (dp[v][c] != -1)

		return dp[v][c];

	ll ways = 1, total = 0;

	if (c == 0) {

		for (auto it : adj[v])

			if (it != p)

				ways = (ways * solve(it, v, 1)) % mod;

		total += ways;

	}

	ways = 1;

	for (auto it : adj[v])

		if (it != p)

			ways = (ways * solve(it, v, 0)) % mod;

	total = (total + ways) % mod;

	return dp[v][c] = total;

}



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(nullptr);

	cout.tie(nullptr);



	cin >> n;

	int x, y;

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

		cin >> x >> y;

		adj[x].push_back(y);

		adj[y].push_back(x);

	}

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

	ll answer = solve(1, 0, 0);

	cout << answer;



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.27780317900721x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



const ll mod = 1e9 + 7;

int n;

vector<vector<int>> adj;

vector<vector<ll>> dp;



ll solve(int cur, int prev, int col) {

	if (dp[cur][col] != -1)

		return dp[cur][col];

	ll tot = 0, w = 1;

	if (col == 0) {

		for (auto it : adj[cur]) {

			if (it != prev) {

				w = (w * solve(it, cur, 1)) % mod;

			}

		}

		tot += w;

	}

	w = 1;

	for (auto it : adj[cur]) {

		if (it != prev) {

			w = (w * solve(it, cur, 0)) % mod;

		}

	}

	tot = (tot + w) % mod;

	return dp[cur][col] = tot;

}



int main() {

	ios_base::sync_with_stdio(false);



	cin >> n;

	adj.resize(n);

	dp.resize(n);

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

		dp[i].resize(2, -1);

	}

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

		int x, y;

		cin >> x >> y;

		x--, y--;

		adj[x].push_back(y);

		adj[y].push_back(x);

	}

	ll answer = solve(0, -1, 0);

	cout << answer;



	return 0;

}