#include <iostream>
#define ll long long
#include <vector>
using namespace std;

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> ans;
    ll curr=1;
    ans.push_back(1);
    for (ll i=2;i<=n-1;i++){
        if(gcd(n,i)==1){
            ans.push_back(i);
            curr*=i;
            curr%=n;
        }
        //cout<<curr<<" ";
    }
    //cout<<endl;
    ll b=0;
    if(curr!=1)b=1;

    cout<<ans.size()-b<<endl;
    cout<<"1 ";
    for(ll i=1;i<ans.size();i++){
        ll x=ans[i];
        if(x!=curr)cout<<x<<" ";
    }
    //cout<<endl;
    return 0;
}