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:
//package graphs;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class PW {
	
	public static FastReader s = new FastReader();
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	
		
		int t=1;
		//int k=0;
		while(t-- >0)
		{
			
			int n=s.nextInt();
			//n++;
			if(n <= 4 || n == 6){
			    System.out.println(1);
			    System.out.println(1);
			    
			  }
			else{
			  ArrayList<Integer> l=new ArrayList<>();
			  for(int i = 1 ;  i < n ; i++){
			    long x = gcd(i, n);
			    if(x == 1)
			      l.add(i);
			  }
			  long pdt = 1;
			  for(int  x: l){
			    pdt = (pdt*x) % n;
//			    cout << x <<" ";
			  }
			  if(pdt == 1)
			  {
			    System.out.println(l.size());
			    for(int x: l){
			      System.out.print(x+" ");
			    }
			  }
			  else{
			    l.remove(l.size()-1);
			    System.out.println(l.size());
			    for(int x: l){
			      System.out.print(x+" ");
			    }
			  }

			 System.out.println();
			}
			
		}
		
	
	}
	
//	public static long fastExpo(long a, long n, long mod) {
//		  long result = 1;
//		  while (n > 0) {
//		    if ((n & 1)>0)
//		      result = (result * a) % mod;
//		    a = (a * a) % mod;
//		    n >>= 1;
//		  }
//		  return result;
//		}
//	1  4   8
	public static long get(long arr[])
	{
	  int N = arr.length;
	  long r = 2;
	  long dist = 2;
	  long curradj = (arr[1] - arr[0]);
	  long prevadj = (arr[1] - arr[0]);
	  for (int i = 2; i < N; i++) {
	    curradj = arr[i] - arr[i - 1];
	    if (curradj == prevadj) {
	      dist++;
	    }
	    else {
	      prevadj = curradj;
	      r = Math.max(r, dist);
	      dist = 2;
	    }
	  }
	  r = Math.max(r, dist);
	  return r;
	}

	 
	public static boolean solve(int a[],int k) {
		
		if(k<=2)
			return true;
		
		//int d=a[1]-a[0];
		for(int i=0;i<a.length-1;i++)
		{
			int d=a[i+1]-a[i],flag=0;
			//System.out.println(d);
			HashMap<Integer,Integer> map=new HashMap<>();
			for(int j=i+1;j<i+k;j++)
			{
				
				if(j>=a.length)
				{
					flag=1;
					break;
				}
				if(map.containsKey(a[j]-a[j-1]))
				{
					map.put(a[j]-a[j-1],map.get(a[j]-a[j-1])+1);
				}
				else
					map.put(a[j]-a[j-1],1);
				

			}
			int f=0;
			for(int nb:map.keySet())
			{
				//System.out.println(k+" "+nb+" "+map.get(nb));
				if(map.get(nb)>1)
				{
					f++;
					if(f==2)
						break;
					//f++;
				}
			}
			if(f<=1 && flag!=1)
				return true;
			
		}
		
		return false;
		  
		}
	public static int count(int b[]){
		  int s = 0;
		  for (int i = 0; i < 32; i++) {
		    if(b[i]>0){
		      s |= (1<<i);
		    }
		  }
		  return s;
		}
	
	public static void remove(int b[], int val){
		  for (int i = 0; i < 32; i++) {
		    if(((val>>i)&1)==1)
		      b[i]--;
		  }
		}
	
	public static void add(int b[], int val){
		  for (int i = 0; i < 32; i++) {
		    if(((val>>i)&1)==1)
		      b[i]++;
		  }
		}
	    public static String largestNumber( List<String> ab) {
	        
	       // List<String> ab= new ArrayList<>();
	       // for(int i=0;i<A.size();i++)
	       // {
	       //     ab.add(String.valueOf(A.get(i)));
	       // }
	        
	        Collections.sort(ab, new Comparator<String>(){ 
	            
	            public int compare(String X, String Y) { 
	          
	        // first append Y at the end of X 
	        String XY=X + Y; 
	          
	        // then append X at the end of Y 
	        String YX=Y + X; 
	          
	        // Now see which of the two formed numbers  
	        // is greater 
	        return XY.compareTo(YX)>0?-1:1; 
	            
	                
	            }
	            
	            
	            
	        });
	        StringBuilder abc= new StringBuilder();
	        
	        
	        for(int i=0;i<ab.size();i++)
	        {
	           abc.append(ab.get(i));
	            
	        }
	        if(abc.length()==0)
	            return abc.toString();
	        
	        if(abc.charAt(0)=='0')
	        return "0";
	        else
	        return abc.toString();
	        
	    }
	
	public static boolean pal(String s)
	{
		int i=0;
		int j=s.length()-1;
		while(i<=j)
		{
			if(s.charAt(i)!=s.charAt(j))
				return false;
			i++;
			j--;
		}
		return true;
	}
	
	
	
	
	static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(
                new InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() { return Integer.parseInt(next()); }
 
        long nextLong() { return Long.parseLong(next()); }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

	
	public static long solve(int n, int r)
    {


        long p = 1, k = 1;
        if (n - r < r) {
            r = n - r;
        }
 
        if (r != 0) {
            while (r > 0) {
                p *= n;
                k *= r;
 
                long m = __gcd(p, k);
 
                
                p /= m;
                k /= m;
 
                n--;
                r--;
            }
 
           
        }
        else {
            p = 1;
        }
 
        
        //System.out.println(p);
        return p;
    }
	
	
	public static long gcd(long a,long b)
	{
		if(a==0||b==0)
			return a+b;
		return gcd(b,(a%b));
	}
	
	public static long __gcd(long n1, long n2)
    {
        long gcd = 1;
 
        for (int i = 1; i <= n1 && i <= n2; ++i) {
            // Checks if i is factor of both integers
            if (n1 % i == 0 && n2 % i == 0) {
                gcd = i;
            }
        }
        return gcd;
    }
	
	public static boolean prime(int n)
	{
		if(n<=2)
			return true;
		
		for(int i=2;i<=Math.sqrt(n);i++)
		{
			if(n%i==0)
				return false;
		}
		
		return true;
		
	}
	public static long fastExpo(long a,long n,long mod){
        if (n == 0)
            return 1;
        else{
            long x = fastExpo(a,n/2,mod);
            if ((n&1) == 1){
                return (((a*x)%mod)*x)%mod;
            }
            else{
                return (((x%mod)*(x%mod))%mod)%mod;
            }
        }
    }
}
class pair{
	//public:
		int f;
		int s;
		pair(int x,int y)
		{
			f=x;
			s=y;
		}
        
}