#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\n\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
ll n;
vector<ll> ans;

inline void solve()
{
    cin >> n;
    for (ll i = 1; i * i < n; ++i)
    {
        if (n % i == 0)
        {
            // cout << i << endl;
            // cout << n / i << endl;
            ans.push_back(i), ans.push_back(n / i);
        }
    }
    if ((ll)sqrt(n) * (ll)sqrt(n) == n)
    {
        // cout << (ll)sqrt(n) << endl;
        ans.push_back((ll)sqrt(n));
    }
    vecupsort(ans);
    for(auto i :ans)
        cout << i << '\n';
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
    {
        solve();
        // if (Test)
        //     putchar('\n');
    }
    TIME__END = clock();
    program_end();
    return 0;
}
#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb push_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

int c[(1<<8)+5][(1<<8)+5];
bool ok[(1<<8)+5];

int main(){
    int n;scanf("%d",&n);
    if(n == 1){
        printf("1\nAB\n");
        return 0;
    }
    printf("%d\n",(1<<n)-1);
    FOR(i,1,(1<<n)-1){
        FOR(j,0,(1<<n)-1) ok[j] = __builtin_popcount(i&j)&1;
        FOR(i,0,(1<<n)-1) printf("%c","AB"[ok[i]]);puts("");
        FOR(i,0,(1<<n)-1) FOR(j,i+1,(1<<n)-1) if(ok[i] != ok[j]) ++c[i][j];
    }
    int tt = c[0][1];
    FOR(i,0,(1<<n)-1) FOR(j,i+1,(1<<n)-1) assert(c[i][j] == tt);
    return 0;
}
