#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
template <typename T>
inline bool Maximize(T& Target, T Value);
template <typename T>
inline bool Minimize(T& Target, T Value);

using namespace std;
using lli = long long;
const int maxN = 1e5;

int n;

int GCD(int x, int y)
{
    while (y != 0)
    {
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}

void Solve()
{
    int a = 1;
    for (int i = 1; i <= n - 2; ++i)
        if (GCD(n, i) == 1)
            a = (lli)a * i % n;
    int lim = (a == 1 && n > 2) ? n - 2 : n - 1;
    int res = 0;
    for (int i = 1; i <= lim; ++i)
        if (GCD(n, i) == 1)
            ++res;
    cout << res << '\n';
    for (int i = 1; i <= lim; ++i)
        if (GCD(n, i) == 1)
            cout << i << ' ';
}

int main()
{
    #ifndef cfc
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    #else
    freopen("input.txt", "r", stdin);
    #endif
    while (cin >> n)
        Solve();
}

template <typename T>
inline bool Maximize(T& Target, T Value)
{
    if (Value > Target)
    {
        Target = Value;
        return true;
    }
    return false;
}

template <typename T>
inline bool Minimize(T& Target, T Value)
{
    if (Value < Target)
    {
        Target = Value;
        return true;
    }
    return false;
}
