// Slower C++ solution:
#include <vector>

#include <iostream>

#include <cmath>

#include <map>

#include <unordered_map>

#include <algorithm>

#include <fstream>

#include <unistd.h>

#include <string>

#include <numeric>

#include <queue>

#include <deque>

#include <sstream>

#include <iomanip>

#include <set>

#include <stack>

#include <cassert>

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef vector<vl> vvl;

typedef vector<vvl> vvvl;

typedef vector<vi> vvi;

typedef vector<vvi> vvvi;

typedef vector<bool> vb;

typedef vector<vector<bool>> vvb;

typedef vector<vvb> vvvb;

typedef vector<vvvb> vvvvb;

typedef vector<string> vs;

typedef vector<vs> vvs;

typedef vector<vvs> vvvs;

typedef vector<char> vc;

typedef vector<vector<char>> vvc;

typedef vector<double> vd;

typedef vector<vd> vvd;

typedef vector<vvd> vvvd;

typedef pair<int, int> P;

typedef pair<ll, ll> PL;

typedef vector<P> vp;

typedef vector<PL> vpl;

typedef vector<vector<P>> vvp;

typedef vector<vector<PL>> vvpl;

const int INF = 1001001001;

const ll LINF = 1e17;

const double pi = 3.1415926535897932;

const string endstr = "\n";

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

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

#define REP(i, n) for(ll i = 0; i < n; i++)

#define RREP(i, n) for(ll i = n-1; i > -1; i--)

#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)

#define ff first

#define ss second

#define pb push_back

#define epb emplace_back



template <typename T>

T gcd(T a, T b) {

    return (a == 0) ? b : gcd(b%a, a);

}

template <typename T>

T lcm(T a, T b) {

    return a / gcd(a, b) * b;

}



bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};

bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};

bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};

bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};

template <typename T>

vector<T> uniquen(vector<T> vec){

    vec.erase(unique(vec.begin(), vec.end()), vec.end());

    return vec;

}



vl e[100100];

ll N;

ll dp[100100][2];



const ll mod = 1e9+7;



void dfs(ll x, ll par = -1){

    dp[x][0] = 1; dp[x][1] = 1;

    for(ll to : e[x]){

        if(to == par) continue;

        dfs(to, x);

        dp[x][0] *= dp[to][0] + dp[to][1];

        dp[x][1] *= dp[to][0];

        dp[x][0] %= mod;

        dp[x][1] %= mod;

    }

}





int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    cin >> N;

    REP(i, N-1){

        ll x, y; cin >> x >> y; x--; y--;

        e[x].pb(y); e[y].pb(x);

    }

    REP(i, 100100) REP(j, 2) dp[i][j] = 0;

    dfs(0);

    

    cout << (dp[0][0] + dp[0][1]) % mod << endstr;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.241869962020899x):
#include <vector>

#include <iostream>

#include <cmath>

#include <map>

#include <unordered_map>

#include <algorithm>

#include <fstream>

#include <unistd.h>

#include <string.h>

#include <string>

#include <numeric>

#include <queue>

#include <deque>

#include <sstream>

#include <iomanip>

#include <set>

#include <stack>

#include <cassert>

#include <functional>

#include <random>

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef vector<vl> vvl;

typedef vector<vvl> vvvl;

typedef vector<vvvl> vvvvl;

typedef vector<vi> vvi;

typedef vector<vvi> vvvi;

typedef vector<bool> vb;

typedef vector<vector<bool>> vvb;

typedef vector<vvb> vvvb;

typedef vector<vvvb> vvvvb;

typedef vector<string> vs;

typedef vector<vs> vvs;

typedef vector<vvs> vvvs;

typedef vector<char> vc;

typedef vector<vector<char>> vvc;

typedef vector<double> vd;

typedef vector<vd> vvd;

typedef vector<vvd> vvvd;

typedef pair<ll, ll> PL;

typedef vector<PL> vpl;

typedef vector<vector<PL>> vvpl;

typedef vector<vvpl> vvvpl;

typedef pair<ll, PL> TL;

typedef vector<TL> vtl;

typedef vector<vtl> vvtl;

const int INF = 1001001001;

const ll LINF = 1e17;

const double pi = 3.1415926535897932;

const string endstr = "\n";

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

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

#define rep(i, n) for(ll i = 0; i < n; i++)

#define rrep(i, n) for(ll i = n-1; i > -1; i--)

#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)

#define ff first

#define ss second

#define pb push_back

#define epb emplace_back

#define ALL(X) (X).begin(),(X).end()



template <typename T>

T gcd(T a, T b) {

    return (a == 0) ? b : gcd(b%a, a);

}

template <typename T>

T lcm(T a, T b) {

    return a / gcd(a, b) * b;

}



bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};

bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};

bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};

bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};

template <typename T>

vector<T> uniquen(vector<T> vec){

    sort(ALL(vec));

    vec.erase(unique(vec.begin(), vec.end()), vec.end());

    return vec;

}



inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};

template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

//friend bool operator<(const stc& lhs, const stc& rhs){

//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);

//}





const ll mod = 1e9+7;

template< int mod >

struct ModInt {

    int x;

    ModInt() : x(0) {}

    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {

        if((x += p.x) >= mod) x -= mod;

        return *this;

    }

    ModInt &operator-=(const ModInt &p) {

        if((x += mod - p.x) >= mod) x -= mod;

        return *this;

    }

    ModInt &operator*=(const ModInt &p) {

        x = (int) (1LL * x * p.x % mod);

        return *this;

    }

    ModInt &operator/=(const ModInt &p) {

        *this *= p.inv();

        return *this;

    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    

    ModInt inv() const {

        int a = x, b = mod, u = 1, v = 0, t;

        while(b > 0) {

            t = a / b;

            swap(a -= t * b, b);

            swap(u -= t * v, v);

        }

        return ModInt(u);

    }

    

    ModInt pow(int64_t n) const {

        ModInt ret(1), mul(x);

        while(n > 0) {

            if(n & 1) ret *= mul;

            mul *= mul;

            n >>= 1;

        }

        return ret;

    }

    

    friend ostream &operator<<(ostream &os, const ModInt &p) {

        return os << p.x;

    }

    

    friend istream &operator>>(istream &is, ModInt &a) {

        int64_t t;

        is >> t;

        a = ModInt< mod >(t);

        return (is);

    }

    

    static int get_mod() { return mod; }

};



using mint = ModInt<mod>;

typedef vector<mint> vm;

typedef vector<vm> vvm;

typedef vector<vvm> vvvm;



vvl G;

vvm dp; // 0 = b, 1 = w;



void dfs(ll now, ll par){

    mint b = 1, w = 1;

    for(ll c : G[now]) if(c != par){

        dfs(c, now);

        b *= dp[1][c];

        w *= dp[0][c] + dp[1][c];

    }

    dp[0][now] = b;

    dp[1][now] = w;

}





int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    ll N; cin >> N; G = vvl(N);

    rep(_, N-1){

        ll a, b; cin >> a >> b; a--; b--;

        G[a].pb(b); G[b].pb(a);

    }

    dp = vvm(2, vm(N, 0));

    dfs(0, -1);

    cout << dp[0][0] + dp[1][0] << endstr;

    return 0;

}