codeparrot/codecomplex huggingface dataset:
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.*;



public class Code {
	public Code(){}
	public static void main(String args[]){
		Scanner QQQ=new Scanner(System.in);
		long l=QQQ.nextLong();
		long r=QQQ.nextLong();
		long ans=l^r;
		int a[]=new int [70];
		int b[]=new int [70];
		int n=0,m=0;
		while (l!=0){
			a[m]=(int)(l%2);
			l/=2;
			m++;
		}
		while (r!=0){
			b[n]=(int)(r%2);
			r/=2;
			n++;
		}
		m--;n--;
		long deg[]=new long [70];
		deg[0]=1;
		for (int i=1;i<=62;i++) deg[i]=deg[i-1]*2;
		for (int i=n;i>=0;i--) 
			if (b[i]==1&&a[i]==0){
				System.out.println(deg[i+1]-1);
				return;
			}
		System.out.println(ans);
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.*;
import java.util.*;

public class ProblemD {
    InputReader in; PrintWriter out;
    void solve() {
        long l = in.nextLong();
        long r = in.nextLong();
        long ans = 0;
        boolean add = false;
        for (int k = 62; k >= 0; k--) {
            long cb = (1L << k);
            if ((l & cb) != (r & cb))
                add = true;
            if (add)
                ans += (1L << k);
        }
        out.println(ans);
    }
    
    ProblemD(){
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        try {
            if (oj) {
                in = new InputReader(System.in);
                out = new PrintWriter(System.out);
            }
            else {
                Writer w = new FileWriter("output.txt");
                in = new InputReader(new FileReader("input.txt"));
                out = new PrintWriter(w);
            }
        } catch(Exception e) {
            throw new RuntimeException(e);
        }
        solve();
        out.close();
    }
    public static void main(String[] args){
        new ProblemD();
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }
    
    public InputReader(FileReader fr) {
        reader = new BufferedReader(fr);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }

}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;

public class A {
    static int[] parent;

    public static int find(int x) {
        if (x == parent[x])
            return x;
        return parent[x] = find(parent[x]);
    }

    public static void union(int x, int y) {
        int px = find(x);
        int py = find(y);
        if (px != py) {
            parent[py] = px;
        }
    }

    public static void main(String[] args) throws Exception {
        int numCnt = (int) nextLong();
        long k = nextLong();
        parent = new int[numCnt];
        for (int i = 0; i < parent.length; i++) {
            parent[i] = i;
        }
        HashMap<Long, Integer> map = new HashMap<Long, Integer>();
        long[] ar = new long[numCnt];
        for (int i = 0; i < numCnt; i++) {
            ar[i] = nextLong();
            map.put(ar[i] * 10007 + ar[i] / 13, i);
        }
        for (int i = 0; i < ar.length; i++) {
            long req = ar[i] * k;
            Integer idx=map.get(req * 10007 + req / 13);
            if (idx!=null) {
                union(i, idx);
            }
        }
        int[] count = new int[numCnt];
        for (int i = 0; i < parent.length; i++) {
            count[find(i)]++;
        }
        int res = 0;
        for (int i = 0; i < numCnt; i++) {
            res += (int) ((count[i] + 1) / 2.0);
        }
        System.out.println(res);
    }

    static BufferedReader br = new BufferedReader(new InputStreamReader(
            System.in));
    static StringTokenizer tokenizer = new StringTokenizer("");

    static long nextLong() throws Exception {
        return Long.parseLong(next());
    }

    static double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }

    static String next() throws Exception {
        while (true) {
            if (tokenizer.hasMoreTokens()) {
                return tokenizer.nextToken();
            }
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            tokenizer = new StringTokenizer(s);
        }
    }
}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn

// @author Sanzhar
import java.io.*;
import java.util.*;
import java.awt.Point;

public class Template {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (Exception e) {
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    public void run() throws Exception {
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter(new FileWriter("output.txt"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
        in.close();
    }

    public void solve() throws Exception {
        int n = nextInt();
        int k = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        boolean[] ok = new boolean[n];
        Arrays.fill(ok, true);
        Arrays.sort(a);
        if (k != 1) {
            for (int i = 0; i < n; i++) {
                if (a[i] % k == 0) {
                    int x = a[i] / k;
                    int ind = Arrays.binarySearch(a, x);
                    if (ind >= 0 && ok[ind]) {
                        ok[i] = false;
                    }
                }
            }
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (ok[i]) {
                ans++;
            }
        }
        out.println(ans);
    }

    public static void main(String[] args) throws Exception {
        new Template().run();
    }
}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.util.*;
import java.math.*;
import java.io.*;

public class Main
	{
	public static void main(String args[]) throws IOException
		{
		BufferedReader c=new BufferedReader(new InputStreamReader(System.in));
		String S[]=c.readLine().split(" ");
		int N=Integer.parseInt(S[0]);
		int K=Integer.parseInt(S[1]);
		int A[]=parseArray(c.readLine(),N);
		shuffle(A);
		Arrays.sort(A);
		
		TreeMap<Long,Long> T=new TreeMap<Long, Long>();
		int ans=0;
		for(int i=0;i<N;i++)
			T.put((long)A[i],1L);
		//System.out.println(Arrays.toString(A));
		if(K==1)
			{
			System.out.println(N);
			return;
			}
		else
			{
			for(int i=0;i<N;i++)
				{
				if(A[i]%K==0&&T.containsKey((long)A[i]/K))		//A[i] is not start of a chain
					continue;
				//System.out.println("considering "+A[i]);
				int chainSize=0;
				long init=A[i];
				while(T.containsKey(init))
					{
					chainSize++;
					init=init*K;
					}
				//System.out.println("\t"+chainSize);
				ans+=(chainSize+1)/2;
				}
			}
		System.out.println(ans);
		}
	/** 
	 * Knuth's shuffle. Generate a random permutation of an array
	 */
	public static int[] shuffle(int A[])
		{
		int N=A.length;
		for(int i=1;i<N;i++)
			{
			int j=(int) (Math.random()*100000)%(i+1); // 0<=j<=i;
			int temp=A[i];
			A[i]=A[j];
			A[j]=temp;
			}
		return A;
		}
	// Parse an integer array of size N from a string s
	public static int[] parseArray(String s,int N)
		{
		int A[]=new int[N];
		StringTokenizer st=new StringTokenizer(s);
		for(int i=0;i<N;i++)
			A[i]=Integer.parseInt(st.nextToken());
		return A;
		}
	}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn



import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

//basically tried to understand ping's greedy alg
public class kMultRedo {
	static int n;
	static int k;
	public static void main(String[] args){
		
		//lol what?? If use HashSet timeout, but if use tree set, not?
		//even with super high initialize capacty = 100,000,where max 100000
		Set<Integer> set = new HashSet<Integer>(1000000);
		FastScanner s = new FastScanner();
		n = s.nextInt();
		k = s.nextInt();
		
		int[] a = new int[n];
		for(int i=0; i<n; i++){
			a[i] = s.nextInt();
		}
		Arrays.sort(a);
		
		for(int i=0; i<n; i++){
			if(a[i]%k !=0){
				set.add(a[i]);
			}else{
				if(!set.contains(a[i]/k)){
					set.add(a[i]);
				}
			}
		}
		
		System.out.println(set.size());
	}
	
	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Set;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zakhar Voit
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();

        Integer[] a = new Integer[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        Set <Integer> vis = new TreeSet<Integer>();
        Arrays.sort(a);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (!(a[i] % k == 0 && vis.contains(a[i] / k))) {
                ++ans;
                vis.add(a[i]);
            }
        }

        out.println(ans);
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    public String nextToken() {
        if (!tok.hasMoreTokens()) {
            try {
                String newLine = in.readLine();
                if (newLine == null)
                    throw new InputMismatchException();
                tok = new StringTokenizer(newLine);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            return nextToken();
        }

        return tok.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    }
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;


public class A {
    
    static StringTokenizer st;
    static BufferedReader in;
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int k = nextInt();
        Integer[]a = new Integer[n+1];
        for (int i = 1; i <= n; i++) {
            a[i] = nextInt();
        }
        if (k==1) {
            System.out.println(n);
            return;
        }
        Arrays.sort(a, 1, n+1);
        Set<Integer> set = new HashSet<Integer>();
        int ans = 0;
        int INF = (int) 1e9;
        for (int i = 1; i <= n; i++) {
            if (set.contains(a[i]))
                continue;
            int t = a[i];
            int s = 1;
            while ((long)t*k <= INF) {
                t *= k;
                if (Arrays.binarySearch(a, 1, n+1,  t) >= 0) {
                    set.add(t);
                    s++;
                }
                else
                    break;
            }
            if (s % 2==0)
                ans += s/2;
            else
                ans += s/2+1;
        }
        System.out.println(ans);
        pw.close();
    }
    private static int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    
    private static long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    
    private static double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
    
    private static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;


public class CFJava {
    private static void println(Integer n) {
        System.out.println(n);
    }

    private static void println(String s) {
        System.out.println(s);
    }

    private static void print(Integer n) {
        System.out.print(n);
    }

    private static void print(String s) {
        System.out.print(s);
    }


    public static void main(String[] args) throws IOException {
        MyScanner scanner = new MyScanner();
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        Integer[] a = scanner.getIntArray(n);
        Arrays.sort(a);
        TreeSet<Integer> res = new TreeSet<Integer>();
        for (Integer i: a){
            if (!res.contains(i/k)||(i%k!=0))
                res.add(i);
        }
        println(res.size());
    }
}

class Pair {
    public int x;
    public int y;

    Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class MyScanner {
    private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private String[] buffer;
    private int pos = 0;

    public Integer nextInt() throws IOException {
        if (buffer == null) {
            buffer = in.readLine().split(" ");
            pos = 0;
        }
        if (buffer.length <= pos) {
            buffer = in.readLine().split(" ");
            pos = 0;
        }
        pos++;
        return Integer.parseInt(buffer[pos - 1]);
    }

    public String nextString() throws IOException {
        if (buffer == null) {
            buffer = in.readLine().split(" ");
            pos = 0;
        }
        if (buffer.length <= pos) {
            buffer = in.readLine().split(" ");
            pos = 0;
        }
        pos++;
        return buffer[pos - 1];
    }

    public ArrayList<Integer> getIntList(Integer n) throws IOException {
        ArrayList<Integer> result = new ArrayList<Integer>(n);
        for (int i = 0; i < n; i++)
            result.add(nextInt());
        return result;
    }

    public Integer[] getIntArray(Integer n) throws IOException {
        Integer[] result = new Integer[n];
        for (int i = 0; i < n; i++)
            result[i]= (nextInt());
        return result;
    }

}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void run() {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt(), k = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; ++i)
			a[i] = in.nextInt();
		Arrays.sort(a);
		int ret = 0, it = 0;
		for (int i = 0; i < n; ++i) {
			int val = a[i] % k == 0 ? a[i] / k : -1;
			while (it < i && a[it] < val) ++it;
			if (it == i || a[it] != val) {
				++ret;
			}
			else {
				a[i] = 0;
			}
		}
		out.println(ret);

		out.close();
	}
}

class InputReader {
	BufferedReader buff;
	StringTokenizer tokenizer;

	InputReader(InputStream stream) {
		buff = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}
	boolean hasNext() {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			try {
				tokenizer = new StringTokenizer(buff.readLine());
			}
			catch (Exception e) {
				return false;
			}
		return true;
	}
	String next() {
		if (!hasNext())
			throw new RuntimeException();
		return tokenizer.nextToken();
	}
	int nextInt() { return Integer.parseInt(next()); }
	long nextLong() { return Long.parseLong(next()); }
}
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author sheep
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();
        HashSet<Integer> set = new HashSet<Integer>();
        int a[] = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int ans = 0;
        int ptr = -1;
        boolean chosen[] = new boolean[n];
        for (int i = 0; i < n; ++i) {
            while (ptr + 1 < i && a[ptr + 1] * (long)k <= a[i]) {
                ++ptr;
            }

            if (a[i] % k != 0 || ptr == -1 || !chosen[ptr] || a[ptr] * (long)k != a[i]) {
                ++ans;
                chosen[i] = true;
            }
        }

        out.println(ans);
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }
// Problem: 274_A. k-Multiple Free Set
// Time complexity: nlogn
import java.io.*;
import java.util.*;

public class A {
    public static void main(String[] args) throws Exception {
        new A().solve();
        // new FileInputStream(new File("input.txt")),
        // new PrintStream(new FileOutputStream(new File("output.txt"))));
    }

    void solve() throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        // Scanner sc = new Scanner(System.in);
        String[] sp;


        sp = in.readLine().split(" ");
        int n = Integer.parseInt(sp[0]);
        long k = Integer.parseInt(sp[1]);
        Long[] a = new Long[n];
        sp = in.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            a[i] = (long) Integer.parseInt(sp[i]);
        }

        Arrays.sort(a);
        TreeSet<Long> set = new TreeSet<Long>();
        for (int i = 0; i < n; i++) {
            long x = a[i];
            if (!set.contains(x)) {
                set.add(x * k);
            }
        }
        System.out.println(set.size());
    }
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//