#include <bits/stdc++.h>
using namespace std;
#define loop(a) for(a='0';a<='1';a++)
int main()
{
char a,b,c,d,e;
int cnt=0;
loop(a)
loop(b)
loop(c)
loop(d)
{
string s; s+=a; s+=b; s+=c; s+=d;
if(s.find("101")==string::npos) cout<<s<<" ",cnt++;
}
cout<<cnt<<"\n";
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIGxvb3AoYSkgZm9yKGE9JzAnO2E8PScxJzthKyspCmludCBtYWluKCkKewoJY2hhciBhLGIsYyxkLGU7CglpbnQgY250PTA7Cglsb29wKGEpCgkJbG9vcChiKQoJCQlsb29wKGMpCgkJCQlsb29wKGQpCgkJCQkJewoJCQkJCQlzdHJpbmcgczsgcys9YTsgcys9Yjsgcys9Yzsgcys9ZDsKCQkJCQkJaWYocy5maW5kKCIxMDEiKT09c3RyaW5nOjpucG9zKQljb3V0PDxzPDwiICIsY250Kys7CgkJCQkJfQoJCQkJCQoJY291dDw8Y250PDwiXG4iOwp9