#include <iostream>
#include <queue>
#define mod 1000000007

using namespace std;
int n,i,x,y;
struct nodS
{
    int parent=0;
    bool viz=false;
    long long dpa=1, dpb=1;
    vector <int> vecini;
} nod[100005];
struct poz
{
    int parent, id;
    poz(int id, int parent)
    {
        this->id=id;
        this->parent=parent;
    }
};
queue <poz> q;
void rez(int poz)
{
    for(auto it : nod[poz].vecini)
    {
        if(it!=nod[poz].parent)
        {
            rez(it);
            nod[poz].dpa*=(nod[it].dpa+nod[it].dpb);
            nod[poz].dpa%=mod;
            nod[poz].dpb*=nod[it].dpa;
            nod[poz].dpb%=mod;
        }
    }
}
int main()
{
    cin>>n;
    for(i=1;i<n;i++)
    {
        cin>>x>>y;
        nod[x].vecini.push_back(y);
        nod[y].vecini.push_back(x);
    }
    for(auto it : nod[1].vecini)
    {
        q.push(poz(it, 1));
    }


    while(!q.empty())
    {
        poz curr=q.front();
        nod[curr.id].parent=curr.parent;
        for(auto it : nod[curr.id].vecini)
            if(it!=curr.parent)
            {
                q.push(poz(it, curr.id));
            }

        q.pop();
    }

    /*
    for(i=1;i<=n;i++)
    {
        cout<<nod[i].parent<<' ';
    }
    */

    rez(1);
    /*
    for(i=1;i<=n;i++)
    {
        cout<<nod[i].dpa<<' '<<nod[i].dpb<<'\n';
    }
    */

    cout<<(nod[1].dpa+nod[1].dpb)%mod;
    return 0;
}