Messed Binary

All submissions for this problem are available.
Binary Representation is Ilya's favourite. She loves binary representation so much that she has completely stopped using decimal representation.
One day on their way to a hackathon her friend Vanya gave Ilya a simple problem to solve. Despite being crazy for binary numbers, Ilya is finding it difficult to answer Vanya problem. The problem is as follows:
Given an array of N positive integers 'A' and a range [a, b], how many numbers exists in range [a, b] (both inclusive), whose binary representation donot contain the binary representation of any of elements of A as a substring.
Can your help her?
Input
First line consists of an integer N, the number of elements in A.
The second line consist of N integers which represents the array A.
The third line consist of two integers a and b.
Output
No of positive integers that follows the constraint mentioned above.
Constraints
 1 <= N <= 10^{4}
 1 <= A_{i} <= 10^{8}
 1 <= a <= b <= 10^{15}
Example
Input:
5
2 4 6 8 10
1 100
Output:
6
Explanation
The numbers' binary representation cannot contain '10' because 2 in present in A. The only numbers left are those whose representation consist of only 1's
3 with binary representation 11
7 with binary representation 111
15 with binary representation 1111
31 with binary representation 11111
63 with binary representation 111111
Author:  dragonslayerx 
Tags  dragonslayerx 
Date Added:  8032016 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions