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 JAVA):

Solution:
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

public class C {

  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer stk;

  public static void main(String[] args) throws Exception {
    in = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(new OutputStreamWriter(System.out));

    preproc();

    /** Choose single or multiple */

    single(0);
    // multiple();

    out.flush();
  }

  static void preproc() {
    // add any preprocessing valid for all tests here
    //
  }

  static long modPow(long n, long pow, long mod) {
    return BigInteger.valueOf(n).modPow(BigInteger.valueOf(pow), BigInteger.valueOf(mod)).longValue();
  }

  static long modInv(long n, long mod, boolean isPrimeModuli) {
    if (isPrimeModuli) {
        return modPow(n, mod - 2, mod);
    }
    return BigInteger.valueOf(n).modInverse(BigInteger.valueOf(mod)).longValue();
  }

  static void single(int testId) throws Exception {
    // add code here
    //
    int n = ni();
    TreeSet<Integer> t = new TreeSet<>();
    long r = 1;
    for (int i = 1; i < n; i++) {
      if (gcd(i, n) != 1) continue; 
      t.add(i);
      r = (r * i) % n;
    }
    if (r != 1) {
      int x = (int) modInv(r, n, false);
      t.remove(x);
    }

    out.println(t.size());
    boolean printed = false;
    for(Integer e: t) {
      if (printed) out.print(" ");
      printed = true;
      out.print(e);
    }
    out.println();
  }

  static void multiple() throws Exception {
    // multiple tests in single file
    int T = ni();
    for (int t = 0; t < T; t++) {
      single(t);
    }
  }

  static void printf(String format, Object... args) {
    out.printf(format, args);
  }

  static void println(String string) {
    out.println(string);
  }

  static long toL(String s) {
    return Long.parseLong(s);
  }

  static int toI(String s) {
    return Integer.parseInt(s);
  }

  static double toD(String s) {
    return Double.parseDouble(s);
  }

  static long toL(BigInteger n) {
    return n.longValue();
  }

  static BigInteger toBI(long n) {
    return BigInteger.valueOf(n);
  }

  static List<Integer> newli() {
    return new ArrayList<Integer>();
  }

  static List<Long> newll() {
    return new ArrayList<Long>();
  }

  static void nia(int[] a, int n) throws Exception {
    for (var i = 0; i < n; i++) {
      a[i] = ni();
    }
  }

  static void nla(long[] a, int n) throws Exception {
    for (var i = 0; i < n; i++) {
      a[i] = nl();
    }
  }

  static void nia(List<Integer> a, int n) throws Exception {
    for (var i = 0; i < n; i++) {
      a.add(ni());
    }
  }

  static void nla(List<Long> a, int n) throws Exception {
    for (var i = 0; i < n; i++) {
      a.add(nl());
    }
  }

  static int ni() throws Exception {
    while (stk == null || !stk.hasMoreTokens()) {
      stk = new StringTokenizer(in.readLine());
    }
    return Integer.parseInt(stk.nextToken());
  }

  static long nl() throws Exception {
    while (stk == null || !stk.hasMoreTokens()) {
      stk = new StringTokenizer(in.readLine());
    }
    return Long.parseLong(stk.nextToken());
  }

  static double nd() throws Exception {
    while (stk == null || !stk.hasMoreTokens()) {
      stk = new StringTokenizer(in.readLine());
    }
    return Double.parseDouble(stk.nextToken());
  }

  static String ns() throws Exception {
    while (stk == null || !stk.hasMoreTokens()) {
      stk = new StringTokenizer(in.readLine());
    }
    return stk.nextToken();
  }

  static int min(int a, int b) {
    return a < b ? a : b;
  }

  static int max(int a, int b) {
    return a > b ? a : b;
  }

  static long min(long a, long b) {
    return a < b ? a : b;
  }

  static long max(long a, long b) {
    return a > b ? a : b;
  }

  static double min(double a, double b) {
    return a < b ? a : b;
  }

  static double max(double a, double b) {
    return a > b ? a : b;
  }

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

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