#include<iostream>
#include<cstdio>
using namespace std;
int dp[1000000+1];
void gg(){
dp[0] = 1;
for(int i = 1;i<=1000000+1;++i){
if(i & 1)
dp[i] = dp[i-1];
else
dp[i] = (dp[i-1] + dp[i/2]) % 1000000000;
}
}
int main(){
gg();
int n;
cin>>n;
cout<<dp[n]<<endl;
}
#include<cstdio>
using namespace std;
int dp[1000000+1];
void gg(){
dp[0] = 1;
for(int i = 1;i<=1000000+1;++i){
if(i & 1)
dp[i] = dp[i-1];
else
dp[i] = (dp[i-1] + dp[i/2]) % 1000000000;
}
}
int main(){
gg();
int n;
cin>>n;
cout<<dp[n]<<endl;
}