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.*;
import java.lang.*;
import java.util.*;
public class a2oj3 {
static class FastScanner {
InputStreamReader is;
BufferedReader br;
StringTokenizer st;
public FastScanner() {
is = new InputStreamReader(System.in);
br = new BufferedReader(is);
}
String next() throws Exception {
while (st == null || !st.hasMoreElements())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
int nextInt() throws Exception {
return Integer.parseInt(next());
}
long nextLong() throws Exception {
return Long.parseLong(next());
}
int[] readArray(int num) throws Exception {
int arr[]=new int[num];
for(int i=0;i<num;i++)
arr[i]=nextInt();
return arr;
}
String nextLine() throws Exception {
return br.readLine();
}
}
 public static boolean power_of_two(int a)
{
  if((a&(a-1))==0)
{
 return true;
}
return false;
}
static boolean PS(double x)
{
if (x >= 0) {
double i= Math.sqrt(x);
if(i%1!=0)
{
return false;
}
return ((i * i) == x);
}
return false;
}
public static int[] ia(int n)
{
    int ar[]=new int[n];
    return ar;
}
public static long[] la(int n)
{
    long ar[]=new long[n];
    return ar;
}
public static void print(int ans,int t)
{
    System.out.println("Case"+" "+"#"+t+":"+" "+ans);
}
//****   M A I N      C O D E     ****
 
public static void main(String args[]) throws java.lang.Exception
{
FastScanner sc=new FastScanner();
int n=sc.nextInt();
int m=sc.nextInt();
int k=sc.nextInt();
int ar[]=new int[m+1];
for(int i=0;i<m+1;i++)
{
ar[i]=sc.nextInt();
}
long sum=0;
for(int i=0;i<m;i++)
{
    if(count(ar[m]^ar[i])<=k)
    {
sum++;
    }
}
System.out.println(sum);
}
public static int  count(int n)
{
   int ans=0;
while(n>0)
{
        n=n&n-1;
    ans++;
 
    n>>=1;
}
return ans;
} 

}