#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
ll gcd(ll a,ll b)
{
	return a%b==0?b:gcd(b,a%b);
}
vector<ll> ans;
int main()
{
		ans.clear();
		int n,sum=1;
		cin>>n;
		if(n==2)
		{
			cout<<1<<endl<<1<<endl;
			return 0;
		}
		for(ll i=1;i<n-1;++i)
		{
			if(gcd(i,n)==1) ans.push_back(i),sum=sum*i%n;
		}
		if(sum!=1) ans.push_back(n-1),sum=sum*(n-1)%n;
		cout<<ans.size()<<endl;
		for(int v:ans) cout<<v<<" ";
		//cout<<endl<<" "<<sum<<endl; 
	return 0;
}