// Original C++ solution (slower):
#include <bits/stdc++.h>



#define f(i,a,b) for( ll i = a; i < b ; i++ )

#define af(i,a,b) for( ll i = a; i >= b ; i--)

#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )

#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)

#define ones(x) (ll) __builtin_popcount(x)

#define fs first

#define sc second

#define pb push_back

#define po pop_back

#define mp make_pair  

#define sz(a) (ll) a.size()

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

#define sor(a) sort( a.begin(), a.end() )

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)

#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)

#define watch(x) cout << (#x) << " is #" << (x) <<"#" <<endl

#define PI 3.1415926535

using namespace std;

typedef long long ll;

typedef long double ld; 

typedef pair<ll,ll> ii ;

typedef vector<ll>  vi ;

typedef vector<ii> vii ;

const ll mod = 1e9+7;

const ll MAX = 1e5+34;

const ll inf = 1e18+7;

vi adj[MAX];

ll dp[MAX][3];



void dfs(ll u, ll parent){

  dp[u][0] = dp[u][1] = 1;

  for(auto v: adj[u]){

    if(v == parent) continue;

    dfs(v,u);

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

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

  }

}



int main(){

  fastio;

  ll n,x,y;

  cin>>n;

  f(i,0,n-1){

    cin>>x>>y;

    x--;y--;

    adj[x].pb(y);

    adj[y].pb(x);

  }

  dfs(0,0);

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

  return 0; 

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define f first

#define s second

#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)

#define pb push_back

#define all(s) begin(s), end(s)

#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

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

#define ENDL '\n'

using namespace std;

typedef long double ld;

typedef long long lli;

typedef pair<lli,lli> ii;

typedef vector<int> vi;

typedef vector<lli> vl;

typedef vector<ii> vii;

typedef vector<vi> vvi;

typedef vector<vl> vvl;

#define deb(x) cout << #x": " << (x) << endl;



const int N = 3e3+5;

const lli INF = 1e18;

const lli MOD = 1e9+7;



vi m;

vi primes(1,2);

vector<vector<ld>>nk;

void sieve(){

	m = vi(N+1,0);

	for(int i = 4; i<N; i+=2)m[i]=1;

	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;

	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);

}



void pascal(){

	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));

	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;

	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];

}



lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}



lli lcm(lli a, lli b){

	if(a<b)swap(a,b);

	lli c = gcd(a,b);

	a/=c;

	return a*b;

}



int popcount(lli x) { return __builtin_popcountll(x); }



lli poww(lli a, lli b){

	lli res =1;

	while(b){

		if(b&1) res = res * a;

		a = a*a;

		b/=2;

	}

	return res;

}



lli powm(lli a, lli b){

	lli res =1;

	while(b){

		if(b&1) res = (res * a)%MOD;

		a = (a*a)%MOD;

		b/=2;

	}

	return res;

}



bool isPrime(lli x){

	if(x==1)return 0;

	for(auto i:primes){

		if(i*i>x)return 1;

		if(x%i==0)return 0;

	}

	return 1;

}



lli SUM(lli a, lli b, lli mod=MOD){

	return (a+b+mod)%mod;

}

lli PROD(lli a, lli b, lli mod=MOD){

	a%=mod; b%=mod;

	return a*b % mod;

}

int dx[4]={-1,0,0,1}, dy[4]={0,1,-1,0};



// ---- コーディングはここから！ ('-')7



void solve(){

	int n; cin>>n;

	vvi v(n+1);

	fore(i,0,n-1){

		int a,b; cin>>a>>b;

		v[a].pb(b);

		v[b].pb(a);

	}

	if(n==1){cout<<2<<ENDL;return;}

	vvl dp(n+1,vl(2,1));

	auto f=[&](auto f, int u, int pr)->void{

		for(auto i:v[u])if(i!=pr)f(f,i,u);

		for(auto i:v[u])if(i!=pr)dp[u][1]=PROD(dp[u][1],SUM(dp[i][0],dp[i][1]));

		for(auto i:v[u])if(i!=pr)dp[u][0]=PROD(dp[u][0],dp[i][1]);

	};

	f(f,1,1);



	cout<<SUM(dp[1][0],dp[1][1])<<ENDL;

}



int main(){_

	//int t; cin>>t; while(t--)

	solve();

}


// Fastest known solution for this problem: