Problem: After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».

The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are numbered form 1 to (m + 1). Types of soldiers are numbered from 0 to n - 1. Each player has an army. Army of the i-th player can be described by non-negative integer xi. Consider binary representation of xi: if the j-th bit of number xi equal to one, then the army of the i-th player has soldiers of the j-th type. 

Fedor is the (m + 1)-th player of the game. He assume that two players can become friends if their armies differ in at most k types of soldiers (in other words, binary representations of the corresponding numbers differ in at most k bits). Help Fedor and count how many players can become his friends.

Input

The first line contains three integers n, m, k (1 ≤ k ≤ n ≤ 20; 1 ≤ m ≤ 1000).

The i-th of the next (m + 1) lines contains a single integer xi (1 ≤ xi ≤ 2n - 1), that describes the i-th player's army. We remind you that Fedor is the (m + 1)-th player.

Output

Print a single integer — the number of Fedor's potential friends.

Examples

Input

7 3 1
8
5
111
17


Output

0


Input

3 3 3
1
2
3
4


Output

3

Solution (in JAVA):

Solution:
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class Main {

    public static void main(String[] args) {
        if (args.length > 0 && args[0].toLowerCase().equals("local")) {
            try {
                System.setIn(new FileInputStream("input.txt"));
                System.setOut(new PrintStream(new File("output.txt")));
            } catch (IOException exc) {
            }
        }
        Task task = new Task();
        task.solve();
    }

    public static class Task {
        static final long MOD = (long) 1e9 + 7;
        static final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        public void solve() {
            try {
                Scan sc = new Scan();
                int n = (int) sc.scanLong();
                int m = (int) sc.scanLong();
                int k = (int) sc.scanLong();

                int[] vals = new int[m];
                for (int i = 0; i < m; ++i) {
                    vals[i] = (int) sc.scanLong();
                }
                int res = 0;
                int fedor = (int) sc.scanLong();
                for (int i = 0; i < m; ++i) {
                    int xored = fedor ^ vals[i];
                    if (Integer.bitCount(xored) <= k) {
                        ++res;
                    }
                }
                out.println(res);
            } finally {
                out.close();
            }
        }

        private void debug(Object... x) {
            StringBuilder sb = new StringBuilder();
            for (Object o : x)
                sb.append(String.valueOf(o)).append(" ");
            out.println(sb);
        }
    }

    public static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public int scan() {
            if (total < 0)
                throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (total <= 0)
                    return -1;
            }
            return buf[index++];
        }

        public long scanLong() {
            long integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else
                    throw new InputMismatchException();
            }
            return neg * integer;
        }

        public double scanDouble() {
            double doub = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n) && n != '.') {
                if (n >= '0' && n <= '9') {
                    doub *= 10;
                    doub += n - '0';
                    n = scan();
                } else
                    throw new InputMismatchException();
            }
            if (n == '.') {
                n = scan();
                double temp = 1;
                while (!isWhiteSpace(n)) {
                    if (n >= '0' && n <= '9') {
                        temp /= 10;
                        doub += (n - '0') * temp;
                        n = scan();
                    } else
                        throw new InputMismatchException();
                }
            }
            return doub * neg;
        }

        public String scanString() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        public char scanChar() {
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            return (char) n;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }
    }
}