local n=io.read("n")
local g={}
for i=1,n do
    g[i]={}
end
for i=1,n-1 do
    local x,y=io.read("n","n")
    g[x][y]=true
    g[y][x]=true
end

local bp,wp={},{}
local mod=1000000007
local function solve(cur,frm)
    bp[cur]=1
    wp[cur]=1
    for nxt in pairs(g[cur]) do
        if nxt~=frm then
            solve(nxt,cur)
            bp[cur]=bp[cur]*wp[nxt]%mod
            wp[cur]=wp[cur]*(wp[nxt]+bp[nxt])%mod
        end
    end
end
solve(1,0)
print(bp[1]+wp[1])