//#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#define mp make_pair
#define pb push_back

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

#if ( ( _WIN32 || __WIN32__ ) && __cplusplus < 201103L)
    #define LLD "%I64d"
#else
    #define LLD "%lld"
#endif

using namespace std;

#define TASKNAME "fraction"

#ifdef LOCAL
static struct __timestamper {
    string what;
    __timestamper(const char* what) : what(what){};
    __timestamper(const string& what) : what(what){};
	~__timestamper(){
        TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;


bool bad(int n, int k, int r) {
	if (r == 1) return false;
	vector<int> v;
	int cur = 1;
	for (int i = 0; i < n; i++) {
		cur *= 2;
		v.pb(cur / r);
		cur %= r;
	}
	#ifdef dbg
	eprintf("%d.", 0);
	for (int i = 0; i < (int)v.size(); i++)
		eprintf("%d", v[i]);
	eprintf(" -> ");
	#endif
	if (2*cur >= r) {
		while (v.size() && v.back() == 1) v.pop_back();
		v.back()++;
	}
	#ifdef dbg
	eprintf("%d.", 0);
	for (int i = 0; i < (int)v.size(); i++)
		eprintf("%d", v[i]);
	eprintf(" * %d = ", r);
	#endif
	int c = 0;
	for (int i = v.size()-1; i >= 0; i--) {
		c = c + v[i]*r;
		v[i] = c % 2;
		c /= 2;
	}
	#ifdef dbg
	eprintf("%d.", c);
	for (int i = 0; i < (int)v.size(); i++)
		eprintf("%d", v[i]);
	eprintf(" -> ");
	#endif
	if (k < (int)v.size()) {
		int tmp = v[k];
		v.resize(k);
		if (tmp) {
			while (v.size() && v.back() == 1) v.pop_back();
			if (v.size()) v.back()++;
			else c++;
		}
	}
	#ifdef dbg
	eprintf("%d.", c);
	for (int i = 0; i < (int)v.size(); i++)
		eprintf("%d", v[i]);
	eprintf("\n");
	#endif
	return (c != 1 || find(v.begin(), v.end(), 1) != v.end());
}

int main(){
    assert(freopen(TASKNAME".in","r",stdin));
    assert(freopen(TASKNAME".out","w",stdout));

  	int n,k,r;
  	scanf("%d%d%d",&n,&k,&r);

  	vector<int> v;
  	for (int i = 1; i <= r; i++)
  		if (bad(n, k, i))
  			v.pb(i);


  	printf("%d\n", v.size());      
  	for (int i = 0; i < (int)v.size(); i++)
  		printf("%d%c", v[i], " \n"[i==(int)v.size()-1]);
    return 0;
}