#include <bits/stdc++.h>
using namespace std;
#define DBG cerr << __LINE__ << ' ' << __FUNCTION__ << endl
#define CLOSE ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mem(t, v) memset ((t) , v, sizeof(t))
#define pb push_back
#define mk make_pair
#define sz(x) (int)(x).size()
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define eps 1e-8
#define LL long long
#define ULL unsigned long long
#define LF putchar('\n')
#define SP putchar(' ')

template<typename T>
void read(T &x) {x = 0;char ch = getchar();LL f = 1;while(!isdigit(ch)){if(ch == '-')f *= -1;ch = getchar();}while(isdigit(ch)){x = x * 10 + ch - 48; ch = getchar();}x *= f;}
template<typename T, typename... Args>
void read(T &first, Args& ... args) {read(first);read(args...);}
template<typename T>
void write(T arg) {T x = arg;if(x < 0) {putchar('-'); x =- x;}if(x > 9) {write(x / 10);}putchar(x % 10 + '0');}
template<typename T, typename ... Ts>
void write(T arg, Ts ... args) {write(arg);if(sizeof...(args) != 0) {putchar(' ');write(args ...);}}
using namespace std;

const LL mod = 1e9 + 7;
const int N = 1e5 + 50;

LL exgcd(LL a, LL b, LL &x, LL &y) {
    if(!b) {
        x = 1, y = 0;
        return a;
    }
    LL d = exgcd(b, a % b, x, y), t = x;
    x = y, y = t - a / b * y;
    return d;
}

LL n;
int vis[N];
vector<pair<LL,LL>>v1;
vector<pair<LL,LL>>v2;
set<LL>ans;

int main() {
	cin >> n;
	for(LL i = 1; i < n; ++i) {
		if(vis[i]) {
			continue;
		}
		LL a = i, b = n, x, y, d;
		d = exgcd(a, b, x, y);
		if(d != 1) {
			continue;
		}
		b /= d;
		x = ((x % b) + b) % b;
		if(vis[x] || x == i) {
			continue;
		}
		vis[i] = vis[x] = 1;
		v1.pb(mk(i, x));
	}
	for(LL i = 1; i < n; ++i) {
		if(vis[i]) {
			continue;
		}
		LL a = i, b = n, x, y, d;
		d = exgcd(a, b, x, y);
		if((n - 1) % d != 0) {
			continue;
		}
		x *= (n - 1) / d;
		b /= d;
		x = ((x % b) + b) % b;
		if(vis[x] || x == i) {
			continue;
		}
		vis[i] = vis[x] = 1;
		v2.pb(mk(i, x));
	}
	for(auto x : v1) {
		ans.insert(x.first);
		ans.insert(x.second);
	}
	for(int i = 1; i < sz(v2); i += 2) {
		ans.insert(v2[i-1].first);
		ans.insert(v2[i-1].second);
		ans.insert(v2[i].first);
		ans.insert(v2[i].second);
	}
	ans.insert(1);
	cout << sz(ans) << endl;
	for(LL x : ans) {
		cout << x << ' ';
	}
	cout << endl;
    return 0;
}
### Prompt

In Cpp, your task is to solve the following problem:

Now you get Baby Ehab's first words: "Given an integer n, find the longest subsequence of [1,2, …, n-1] whose product is 1 modulo n." Please solve the problem.

A sequence b is a subsequence of an array a if b can be obtained from a by deleting some (possibly all) elements. The product of an empty subsequence is equal to 1.

Input

The only line contains the integer n (2 ≤ n ≤ 10^5).

Output

The first line should contain a single integer, the length of the longest subsequence.

The second line should contain the elements of the subsequence, in increasing order.

If there are multiple solutions, you can print any.

Examples

Input


5


Output


3
1 2 3 

Input


8


Output


4
1 3 5 7 

Note

In the first example, the product of the elements is 6 which is congruent to 1 modulo 5. The only longer subsequence is [1,2,3,4]. Its product is 24 which is congruent to 4 modulo 5. Hence, the answer is [1,2,3].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define DBG cerr << __LINE__ << ' ' << __FUNCTION__ << endl
#define CLOSE ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mem(t, v) memset ((t) , v, sizeof(t))
#define pb push_back
#define mk make_pair
#define sz(x) (int)(x).size()
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define eps 1e-8
#define LL long long
#define ULL unsigned long long
#define LF putchar('\n')
#define SP putchar(' ')

template<typename T>
void read(T &x) {x = 0;char ch = getchar();LL f = 1;while(!isdigit(ch)){if(ch == '-')f *= -1;ch = getchar();}while(isdigit(ch)){x = x * 10 + ch - 48; ch = getchar();}x *= f;}
template<typename T, typename... Args>
void read(T &first, Args& ... args) {read(first);read(args...);}
template<typename T>
void write(T arg) {T x = arg;if(x < 0) {putchar('-'); x =- x;}if(x > 9) {write(x / 10);}putchar(x % 10 + '0');}
template<typename T, typename ... Ts>
void write(T arg, Ts ... args) {write(arg);if(sizeof...(args) != 0) {putchar(' ');write(args ...);}}
using namespace std;

const LL mod = 1e9 + 7;
const int N = 1e5 + 50;

LL exgcd(LL a, LL b, LL &x, LL &y) {
    if(!b) {
        x = 1, y = 0;
        return a;
    }
    LL d = exgcd(b, a % b, x, y), t = x;
    x = y, y = t - a / b * y;
    return d;
}

LL n;
int vis[N];
vector<pair<LL,LL>>v1;
vector<pair<LL,LL>>v2;
set<LL>ans;

int main() {
	cin >> n;
	for(LL i = 1; i < n; ++i) {
		if(vis[i]) {
			continue;
		}
		LL a = i, b = n, x, y, d;
		d = exgcd(a, b, x, y);
		if(d != 1) {
			continue;
		}
		b /= d;
		x = ((x % b) + b) % b;
		if(vis[x] || x == i) {
			continue;
		}
		vis[i] = vis[x] = 1;
		v1.pb(mk(i, x));
	}
	for(LL i = 1; i < n; ++i) {
		if(vis[i]) {
			continue;
		}
		LL a = i, b = n, x, y, d;
		d = exgcd(a, b, x, y);
		if((n - 1) % d != 0) {
			continue;
		}
		x *= (n - 1) / d;
		b /= d;
		x = ((x % b) + b) % b;
		if(vis[x] || x == i) {
			continue;
		}
		vis[i] = vis[x] = 1;
		v2.pb(mk(i, x));
	}
	for(auto x : v1) {
		ans.insert(x.first);
		ans.insert(x.second);
	}
	for(int i = 1; i < sz(v2); i += 2) {
		ans.insert(v2[i-1].first);
		ans.insert(v2[i-1].second);
		ans.insert(v2[i].first);
		ans.insert(v2[i].second);
	}
	ans.insert(1);
	cout << sz(ans) << endl;
	for(LL x : ans) {
		cout << x << ' ';
	}
	cout << endl;
    return 0;
}
```