#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ld;
typedef unsigned long long int lu;
typedef vector< int > vi;
typedef vector < ld > vd;
typedef set <ld> sd;
typedef vector< vi > vvi;
typedef vector< vd > vvd;
typedef pair< int,int > ii;
typedef pair< ld,ld > id;
#define sz(a) ld((a).size())
#define test(t) ll t;cin>>t;while(t--)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Vi vector
#define pr pair
#define mpr make_pair
#define fi first
#define se second
#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

set <ld> s[100005];
ld d[100005];

vector<char> prime (100000+1, true);
void sieve(ld n)
{	
	//O(nloglogn) time
	prime[0] = prime[1] = false;
	for (ld i=2; i<=n; ++i)
	{
		if (prime[i])
		{
			s[i].insert(i);			
			for (ld j=2*i; j<=n; j+=i)
			{
				prime[j] = false;
				s[j].insert(i);
			}
		}
	}
}
#define forn(i,e) for(int i = 0; i < e; i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define reprev(i,a,b) for(i=a;i>=b;i--)

#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
ld gcd(ld a, ld b) { if(b == 0) return a; return gcd(b, a % b); }
ld fastpowMOD(ld a, ld p,ld MOD){ if(p==0) return 1; ld z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
ld fastpow(ld a, ld p){ if(p==0) return 1; ld z = fastpow(a,p/2); z = (z*z); if(p%2) z = (z*a); return z; }
ld a,b;

ld search1(ld a[], ld f,ld n)
{
	ld left=1;
	ld right=n+1;
	while(right-left>1)
	{
		ld mid = left + (right-left)/2;
		if(a[mid]<f)
		{
			left=mid;
		}
		else right=mid;
	}
	return a[left];
}
ld  p = 1e9+7;
vector<ld> v[100002];
ld dp[100002][2];
ld getx(ld x,bool lt,bool br[])
{
	//br[x]=true;
	if(!lt)
	{
		if(dp[x][0]!=-1)return dp[x][0];
		if(v[x].empty()){dp[x][0]=1;return dp[x][0];}
		br[x]=1;
		ld cnt = 1;
		for(ld f : v[x])
		{
			if(br[f])continue;
			cnt = (cnt*(getx(f,0,br)+getx(f,1,br)))%p;
		}
		dp[x][0]=cnt%p;
		br[x]=0;
		return dp[x][0];
	}
	if(lt)
	{
		if(dp[x][1]!=-1)return dp[x][1];
		if(v[x].empty()){dp[x][1]=1;return dp[x][1];}
		br[x]=1;
		ld cnt = 1;
		for(ld f : v[x])
		{
			if(br[f])continue;
			cnt = (cnt*getx(f,0,br))%p;
		}
		dp[x][1]=cnt%p;
		br[x]=0;
		return dp[x][1];
	}
}

int main(){
	ld n,i,j;
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,0,n-1)
	{
		ld x,y;
		cin >> x >> y;
		v[x].pb(y);
		v[y].pb(x);
	}
	bool br[n+1]={0};
	ld cnt = (getx(1,0,br)+getx(1,1,br))%p;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 19840