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

using namespace std;

typedef long long ll;



const int mxN = 1e5 + 5, mod = 1e9 + 7;

int N;

vector<int> adj[mxN];

int dp[mxN][2];



int rec(int u, int p, int pc) {

	if (dp[u][pc] != -1) {

		return dp[u][pc];

	}

	ll tot = 0, ways = 1;

	if (pc == 0) {

		for (int v : adj[u]) {

			if (v == p) {

				continue;

			}

			ways = (ways * rec(v, u, 1)) % mod;

		}

		tot = ways;

	}

	ways = 1;

	for (int v : adj[u]) {

		if (v == p) {

			continue;

		}

		ways = (ways * rec(v, u, 0)) % mod;

	}

	tot = (tot + ways) % mod;

	return dp[u][pc] = tot;

}



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	cin >> N;

	int x, y;

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

		cin >> x >> y;

		x--, y--;

		adj[x].push_back(y);

		adj[y].push_back(x);

	}

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

	int ans = rec(0, -1, 0);

	cout << ans;

	

	return 0;

}