#include<bits/stdc++.h>

using namespace std;
const int maxn = 1e5 + 5;
int n;
int a[maxn], sum, cnt;
int pos;

int gcd(int x, int y) {
	if (!y) return x;
	return gcd(y, x % y);
}

int main() {
	scanf("%d", &n);
	sum = 1;
	for (int i = 1; i < n; i++) {
		if (gcd(i, n) == 1) {
			a[++cnt] = i;
			sum = 1LL * sum * i % n;
		}
	}
	if (sum == 1) {
		printf("%d\n", cnt);
		for (int i = 1; i <= cnt; i++) printf("%d ", a[i]);
	} else {
		for (int i = 1; i <= cnt; i++) {
			if (a[i] % n == sum) {
				pos = i;
				break;
			}
		}
		printf("%d\n", cnt - 1);
		for (int i = 1; i <= cnt; i++) {
			if (pos != i) printf("%d ", a[i]);
		}
	}
	return 0;
}