CSES - Shared codeLink to this code: https://cses.fi/paste/e0c08c1dc65da1609789a7/
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int inv = 500000004;
const int mod = 1e9 + 7;
 
int rec(int i, int j, vector<vector<int>> &dp){
    if (j == 0) return 1;
    if (i == 0) return 0;
    if (dp[i][j] != -1) return dp[i][j];
    int take = 0;
    if (j - i >= 0) take = rec(i-1, j-i, dp);
    int notTake = rec(i-1, j, dp);
    return dp[i][j] = (take % mod + notTake % mod)%mod;
}
 
void solve(){
    int n; cin>>n;
    int sum = (n*(n+1)) / 2;
    if (sum % 2 != 0){
        cout<<0;
        return;
    }
    int target = sum / 2;
    vector<vector<int>> dp(n+1, vector<int> (target+1, -1));
    cout<<(rec(n, target, dp) * inv)%mod;
}

int32_t main()
{
	solve();
}