#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define me(a,x) memset(a,x,sizeof(a))
#define sf scanf
#define pf printf
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define gcd __gcd
#define pb push_back
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x) cout<<"x="<<x<<endl
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const ll llINF=9223372036854775807;
const int maxn=1e5+10;
const double pi=acos(-1.0);
ll gcd(ll a,ll b)
{
    return b?gcd(b,a%b):a;
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}
using namespace std;

ll n;
ll sum=0;
ll shu[maxn];
ll res;

void solve()
{
    sf("%lld",&n);
    res=1;
    int idx=0;
    rep(i,1,n)
    {
        if(gcd(i,n)==1)
        {
            res=res*i;
            res%=n;
        }
    }
    if(res==1)
    {
        rep(i,1,n)
        {
            if(gcd(i,n)==1)
            {
                idx++;
                shu[idx]=i;
            }
        }
        pf("%d\n",idx);
        rep(i,1,idx)
        {
            pf("%d",shu[i]);
            if(i<idx) pf(" ");
            else pf("\n");
        }
    }
    else
    {
        rep(i,1,n-2)
        {
            if(gcd(i,n)==1)
            {
                idx++;
                shu[idx]=i;
            }
        }
        pf("%d\n",idx);
        rep(i,1,idx)
        {
            pf("%d",shu[i]);
            if(i<idx) pf(" ");
            else pf("\n");
        }
    }
}

int main()
{
//    IOS;
    solve();
    return 0;
}
