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].

Solution (in CPP):

Solution:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm> 
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
#include <bitset>
#include <assert.h>   
using namespace std;
 
#define int                  long long int
#define uint                  unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(int i=(int)a;i<(int)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountint(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define aint(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
 
const int MOD = 1000000007;
 
int modpow(int a, int b, int mod) { int res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res %= mod; a = a * a; a %= mod; }return res; }
int p(int a, int b) { int res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; a = a * a; }return res; }


int gcd(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    int x1, y1;
    int d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

void testcases(int test) {
    int n; cin >> n;
    set<int> ans; ans.insert(1);
    set<int> temp; int prod = 1;
    loop(i,2,n) {
        int x,y;
        int g = gcd(i, n, x, y);
        if(g != 1) continue;
        x = (x%n + n)%n;
        //cout << x << " " << i << "\n";
        if(x == i) { prod *= i; prod%=n; temp.insert(i); continue; }
        ans.insert(x); ans.insert(i);
    }
    if(prod == 1) {
        for(int i : temp) ans.insert(i);
    }
    cout << ans.size() << "\n";
    //cout << ans.size() << " "  << temp.size() << " "  << prod <<  "\n";
    prod = 1;
    for(int i : ans) { prod*= i; prod%=n; cout << i << " ";  }
    assert(prod == 1);
    //for(int i : temp) cout << i << " "; cout << "\n";
}     
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */ 
    int t; 
    // cin >> t;
    t = 1;
    loop(i,0,t) testcases(i);
    /* end code */
}