#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

vector<vector<Int>> G;
vector<Int> seen;
vector<vector<mint>> dp;

mint solve(Int v,Int col,Int oya) {

	//seen[v] = 1;

	if (dp[v][col]!=-1) {
		return dp[v][col];
	}

	

	if (col) {//頂点vを黒に塗る場合
		mint res = 1;
		for (const auto& nv : G[v]) {
			if (nv==oya) {//vの親の場合
				continue;
			}
			res *= solve(nv, 0,v);
		}

		return dp[v][col] = res;
	}
	else {//頂点vを白に塗る場合
		mint res = 1;
		for (const auto& nv : G[v]) {
			if (nv==oya) {
				continue;
			}
			res *= (solve(nv, 0,v) + solve(nv, 1,v));

		}
		return dp[v][col] = res;
	}

}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	G.resize(N);
	Int x, y;
	for (Int i = 0; i < N-1; i++) {
		cin >> x >> y;
		x--;
		y--;
		G[x].push_back(y);
		G[y].push_back(x);
	}

	dp.resize(N);
	for (Int i = 0; i < N; i++) {
		dp[i].resize(2, -1);
	}

	for (Int i = 1; i < N; i++) {
		if (G[i].size()==1) {
			dp[i][0] = 1;
			dp[i][1] = 1;
		}
	}

	mint ans;
	seen.resize(N);
	solve(0, 0,-1);
	//fill(seen.begin(),seen.end(), 0);
	solve(0, 1,-1);

	ans = dp[0][0]+dp[0][1];
	cout << ans << "\n";

}


Measured memory_bytes: 18944