class GoUpstairs { public: int countWays(int n) { if(n==1) { return 0; } if(n==2) { return 1; } if(n==3) { return 2; } else { vector <int> d; int i=0; d.push_back(0); d.push_back(1); d.push_back(2); for(i=3;i<n;i++) { d.push_back(d[i-1]%1000000007+d[i-2]%1000000007); } return d[n-1]%1000000007; } return 0; } };