Octave, 62 61 bytes
@(n)sum(arrayfun(@(t)any(strfind((g=@dec2bin)(n),g(t))),1:n))
###Explanation
Explanation
For input n, the code tests all numbers from 1 to n to see if their binary representation is a substring of the binary representation of the input.
@(n) % Anonymous function of n
arrayfun( ,1:n) % Map over range 1:n
@(t) % Anonymous function of t
strfind( , ) % Indices of ...
g(t) % t as binary string ...
(g=@dec2bin)(n) % within n as binary string
any( ) % True if contains nonzero
sum( ) % Sum of array