#include #include #include #include using namespace std; using uint = unsigned int; #define CIN( LL , A ) LL A; cin >> A #define QUIT return 0 #define RETURN( ANSWER ) cout << ( ANSWER ) << endl; QUIT #include string EnumerateHereditarilyFiniteSets( uint n ) { string s{}; uint i = 0; while( n != 0 ){ if( n % 2 == 1 ){ s += "," + EnumerateHereditarilyFiniteSets( i ); } n /= 2; i++; } s = "{" + ( s == "" ? s : s.substr( 1 ) ) + "}"; return s; } int main() { CIN( uint , N ); assert( N <= 1000000 ); RETURN( EnumerateHereditarilyFiniteSets( N ) ); }