The year 2015 is almost over.Limak is a little polar bear. He has recently learnt about the binary system. He noticed that the passing year has exactly one zero in its representation in the binary system — 201510 = 111110111112. Note that he doesn't care about the number of zeros in the decimal representation.Limak chose some interval of years. He is going to count all years from this interval that have exactly one zero in the binary representation. Can you do it faster?Assume that all positive integers are always written without leading zeros.

The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 1018) — the first year and the last year in Limak's interval respectively.

Print one integer – the number of years Limak will count in his chosen interval.

NoteIn the first sample Limak's interval contains numbers 510 = 1012, 610 = 1102, 710 = 1112, 810 = 10002, 910 = 10012 and 1010 = 10102. Two of them (1012 and 1102) have the described property.

using System;
 public class Program
    {
        public static void Main(string[] args)
        {
          string[] input = Console.ReadLine().Split(new char[] { 't', '\r', '\n', ' ' }, StringSplitOptions.RemoveEmptyEntries);
          Console.WriteLine((ZeroCounter(Convert.ToString(long.Parse(input[1]), 2))- ZeroCounter(Convert.ToString((long.Parse(input[0])-1l), 2))));
        }
        private static long ZeroCounter(string number)
        {
            long result = (number.Length - 2) * (number.Length - 1) / 2;
            int index = number.IndexOf('0', 1);
            if (index == -1) result += (number.Length - 1);
            else
            {
                result += index;
                index = number.IndexOf('0', index + 1);
                if (index > 0) result--;
            }
            return result;
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            long a = long.Parse(line[0]);
            long b = long.Parse(line[1]);
            long S, ans = 0;
            for (int i = 62; i >= 0; i--)
            {
                S = 0;
                for (int j = i - 1; j >= 0; j--)
                    S += 1L << j;
                for (int j = i + 1; j < 64; j++)
                {
                    S += 1L << j;
                    if (a <= S && S <= b)
                        ans++;
                }
            }
            Console.Write(ans);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using SB = System.Text.StringBuilder;
using Number = System.Int64;
using System.Numerics;
using static System.Math;
//using static MathEx;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var a = rl;
            var b = rl;
            IO.Printer.Out.WriteLine(f(b) - f(a - 1));
        }
        long f(long n)
        {
            var ret = 0L;
            for (int i = 0; i < 62; i++)
            {
                var v = (1L << (i + 1)) - 1;
                for (int j = 0; j < i; j++)
                {
                    if (v - (1L << j) <= n)
                    {
                        Debug.WriteLine(v - (1L << j));
                        ret++;
                    }
                }
            }

            return ret;
        }

        int ri => sc.Integer();
        long rl => sc.Long();
        double rd => sc.Double();
        string rs => sc.Scan();
        char rc => sc.Char();

        [System.Diagnostics.Conditional("DEBUG")]
        void put(params object[] a) => Debug.WriteLine(string.Join(" ", a));

        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer: StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != 0 && b != '-' && (b < '0' || '9' < b));
            if (b == 0) return long.MinValue;
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion

using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
using Number = System.Int64;

namespace Program
{

    public class Solver
    {
        public void Solve()
        {
            var a = sc.Long() - 1;
            var b = sc.Long();
            var B = f(b);
            var A = f(a);
            Debug.WriteLine(A);
            Debug.WriteLine(B);
            IO.Printer.Out.WriteLine(f(b) - f(a));
        }
        public long f(long v)
        {
            if (v == 0) return 1;

            var h = 0;
            for (int i = 0; i < 60; i++)
                if ((v >> i & 1) == 1) h = i;

            var dp = new long[3, 2];
            dp[0, 1] = 1;
            dp[1, 0] = 1;
            for (int i = h - 1; i >= 0; i--)
            {
                var next = new long[3, 2];

                if ((v >> i & 1) == 1)
                {
                    next[0, 1] += dp[0, 1];
                    next[1, 1] += dp[1, 1];
                    next[1, 0] += dp[0, 1];
                }
                else
                {
                    next[1, 1] += dp[0, 1];
                }
                next[0, 0] += 1;
                next[0, 0] += dp[0, 0];
                next[1, 0] += dp[0, 0];
                next[1, 0] += dp[1, 0];
                dp = next;
            }

            return dp[1, 0] + dp[1, 1];
        }

        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != 0 && b != '-' && (b < '0' || '9' < b));
            if (b == 0) return long.MinValue;
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { var s = Scan(); return s != "" ? double.Parse(Scan(), CultureInfo.InvariantCulture) : double.NaN; }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]);
            long b = long.Parse(s[1]);
            long ans = 0;
            char[] ch = new char[62];
            for (int i = 0; i < 62; i++)
                ch[i] = '1';
            for (int q = 0; q < 62; q++)
            {
                ch[q] = '0';
                for (int i = q + 2; i < 62; i++)
                {
                    ch[i] = '0';
                    string number = "";
                    for (int j = 0; j < 62; j++)
                        number += ch[j];
                    ch[i] = '1';
                    long decimalNumber = Convert.ToInt64(number, 2);
                    if ((decimalNumber >= a) && (decimalNumber <= b))
                        ans++;
                }
            }
            Console.WriteLine(ans);
            //Console.ReadKey();
        }
    }
}

using System;

class Program{
	static void Main(string[] args){
		string[] tokens = Console.ReadLine().Split();
		ulong start = ulong.Parse(tokens[0]), end = ulong.Parse(tokens[1]);
		// Console.WriteLine("{0}, {1}", Convert(start), Convert(end));
		Console.WriteLine(Count(start, end));
	}
	static string Convert(ulong num){
		string ans = "";
		if(num == 0){
			return "0";
		}
		while(num > 0){
			if(num % 2 == 0){
				ans = "0" + ans;
			}else{
				ans = "1" + ans;
			}
			num = (ulong) num / 2;
		}
		return ans;
	}
	static ulong Count(ulong start, ulong end){
		string s = Convert(start), e = Convert(end);
		int i = 0;

		ulong left;
		for(i = 0; i < s.Length; ++i){
			if(s[i] == '0'){
				break;
			}
		}
		left = (ulong) (s.Length - i);

		ulong right;
		for(i = 0; i < e.Length; ++i){
			if(e[i] == '0'){
				break;
			}
		}

		right = (ulong) (i - 1);
		for(i += 1; i < e.Length; ++i){
			if(e[i] == '0'){
				break;
			}
		}

		if(i == e.Length){
			right++;
		}

		if(s.Length == e.Length){
			return right + left + 1 - (ulong) s.Length;
		}else{
			ulong middle = 0;
			for(i = s.Length + 1; i < e.Length; ++i){
				middle = middle + (ulong) i - 1;
			}
			return left + middle + right;
		}
	}
}

using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

class Program
{
    public void Solve()
    {
        long A = Reader.Long(), B = Reader.Long();
        Func<long, int> Count = N =>
        {
            int count = 0;
            for (int len = 2; len <= 62; len++)
                for (int bitAt = 0; bitAt < len - 1; bitAt++)
                {
                    long x = (1L << len) - 1 & ~(1L << bitAt);
                    if (x <= N) count++;
                }
            return count;
        };

        Console.WriteLine(Count(B) - Count(A - 1));
    }
}

class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    private static TextReader reader = Console.In;
    private static readonly char[] separator = { ' ' };
    private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    private static string[] A = new string[0];
    private static int i;
    private static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }
    public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }
    public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); }
    public static string Line() { return reader.ReadLine().Trim(); }
    private static string[] Split(string s) { return s.Split(separator, op); }
    private static string Next() { CheckNext(); return A[i++]; }
    private static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

using System;

namespace Olymp
{
  public class ProblemSolver
  {
    public void Solve()
    {
      string[] input = Console.ReadLine().Split();
      long a = long.Parse(input[0]);
      long b = long.Parse(input[1]);
      int c = 0;
      for (int i = 1; i < 64; i++)
      {
        long n = (1L << i) - 1;
        for (int j = 0; j < i - 1; j++)
        {
          long m = 1L << j;
          long x = n - m;
          if (a <= x && x <= b)
            ++c;
        }
      }
      Console.Write(c);
    }
  }

  class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver();
      solver.Solve();
    }
  }
}

using System;
using System.Linq;

namespace Test
{
    static class Program
    {
        static void Main(string[] args)
        {
            string temp = Console.ReadLine();
            long[] temps = temp.Split(new[] { " " }, StringSplitOptions.None).Select(long.Parse).ToArray();
            string s1 = Convert.ToString(temps[0], 2);
            string s2 = Convert.ToString(temps[1], 2);
            s1 = FindNext(s1);
            s2 = FindPrev(s2);
            Console.WriteLine(Count(s1, s2));
        }

        static int Count(string s1, string s2)
        {
            long l1 = Convert.ToInt64(s1, 2);
            long l2 = Convert.ToInt64(s2, 2);
            if (l1 > l2) return 0;
            if (l1 == l2) return 1;

            int total = 0;
            int iS = s1.Length;
            int iE = s2.Length;
            int i1 = s1.IndexOf("0");
            int i2 = s2.IndexOf("0");
            if (iS == iE) return i2 - i1 + 1;
            total += iS - i1;
            total += i2;
            for (int i = iS + 1; i < iE; i++) total += i - 1;
            return total;
        }

        static string FindNext(string s)
        {
            string t;
            int index = s.IndexOf("0");
            if (index != -1)
            {
                int iindex = s.IndexOf("0", index + 1);
                if (iindex == -1) return s;
                t = s.Remove(index + 1);
                for (int i = index + 1; i < s.Length; i++) t += "1";
                return t;
            }
            t = "10";
            for (int i = 1; i < s.Length; i++) t += "1";
            return t;
        }

        static string FindPrev(string s)
        {
            if (s.Equals("1")) return "1";
            if (s.Equals("10")) return "10";
            string t = null;
            int index = s.IndexOf("0");
            if (index != -1)
            {
                int iindex = s.IndexOf("0", index + 1);
                if (iindex == -1) return s;
                for (int i = 0; i < index - 1; i++) t += "1";
                t += "0";
                for (int i = index; i < s.Length; i++) t += "1";
                return t;
            }
            t = s.Remove(s.Length - 1) + "0";
            return t;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;

namespace Beresta
{

	class ContestIO : StreamWriter
	{
		public ContestIO() : base(Console.OpenStandardOutput(8192), Encoding.ASCII, 8192) { }
		//d.ToString("N12", CultureInfo.InvariantCulture).Replace(",", "")
		public StreamReader Reader = new StreamReader(Console.OpenStandardInput(8192), Encoding.ASCII, false, 8192);
		bool IsDigit(long c) { return c >= '0' && c <= '9'; }

		public long Read()
		{
			long c1 = 0, c;
			while (!IsDigit(c = Reader.Read())) { c1 = c; }
			long r = c - '0';
			while (IsDigit(c = Reader.Read()))
				r = r * 10 + c - '0';
			return c1 == '-' ? -r : r;
		}
	}

	class Program
	{

		static void Main(string[] args)
		{
			using (var io = new ContestIO())
			{
				var a = io.Read();
				var b = io.Read();

				var s2 = Convert.ToString(a, 2);
				var e2 = Convert.ToString(b, 2);

				var ind = s2.IndexOf('0');
				var pos = 0;
				var len = 0;
				if(ind > -1)
				{
					s2 = s2.Substring(0, ind + 1).PadRight(s2.Length, '1');
					a = Convert.ToInt64(s2, 2);

					len = s2.Length;
					pos = ind;
				}
				else
				{
					len = s2.Length + 1;
					pos = 1;
				}

				var count = 0L;
				while (true)
				{
					a = GetNum(len, pos);
					if (a <= b)
						count++;
					else
						break;

					pos++;
					if (pos == len)
					{
						pos = 1;
						len++;
					}
				}

				io.WriteLine(count);
			}

			Console.ReadLine();
		}

		static long GetNum(int len, int pos)
		{
			return ((1L << len) - 1L) & ~(1L << (len - pos - 1));
		}

	}

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;

namespace Beresta
{

	class ContestIO : StreamWriter
	{
		public ContestIO() : base(Console.OpenStandardOutput(8192), Encoding.ASCII, 8192) { }
		//d.ToString("N12", CultureInfo.InvariantCulture).Replace(",", "")
		public StreamReader Reader = new StreamReader(Console.OpenStandardInput(8192), Encoding.ASCII, false, 8192);
		bool IsDigit(long c) { return c >= '0' && c <= '9'; }

		public long Read()
		{
			long c1 = 0, c;
			while (!IsDigit(c = Reader.Read())) { c1 = c; }
			long r = c - '0';
			while (IsDigit(c = Reader.Read()))
				r = r * 10 + c - '0';
			return c1 == '-' ? -r : r;
		}
	}

	class Program
	{

		static void Main(string[] args)
		{
			using (var io = new ContestIO())
			{
				var a = io.Read();
				var b = io.Read();

				var count = 0L;
				var v = 1L;
				for (var i = 1; i <= 100; i++)
				{
					v |= 1L << i;
					var v1 = v - 1;
					for (var j = 0; j < i; j++)
					{
						if (v1 >= a && v1 <= b)
							count++;
						v1 = ((v1 << 1) & v) | 1;
					}

					if (v > b)
						break;
				}

				io.WriteLine(count);
			}

			Console.ReadLine();
		}

	}

}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace New_Year_and_Old_Property
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static IEnumerable<long> List()
        {
            long l = long.MaxValue;

            while (l > 1)
            {
                long next = l >> 1;
                long i = 1;

                while (i <= next)
                {
                    yield return l ^ i;
                    i <<= 1;
                }

                l = next;
            }
        }

        private static void Main(string[] args)
        {
            long a = Next();
            long b = Next();

            writer.WriteLine(List().Count(l => l >= a && l <= b));
            writer.Flush();
        }

        private static long Next()
        {
            int c;
            long res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace New_Year_and_Old_Property
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            long a = Next();
            long b = Next();

            int count = 0;

            string sa = Convert.ToString(a, 2);
            string sb = Convert.ToString(b, 2);

            for (int i = sa.Length; i <= sb.Length; i++)
            {
                for (int j = 0; j < i-1; j++)
                {
                    string sx = new string('1', i - j - 1) + "0" + new string('1', j);
                    long x = Convert.ToInt64(sx, 2);
                    if (x >= a && x <= b)
                        count++;
                }
            }

            writer.WriteLine(count);
            writer.Flush();
        }

        private static long Next()
        {
            int c;
            long res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _611B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long a = long.Parse(input[0]), b = long.Parse(input[1]);

            int result = 0;
            var hashset = new HashSet<long>();
            for (int power = 1; power < 64; power++)
            {
                long x = (1L << power) - 1;
                for (int i = 0; i <= power - 2; i++)
                {
                    long y = x - (1L << i);
                    if (y >= a && y <= b && !hashset.Contains(y))
                    {
                        result++;
                        hashset.Add(y);
                    }
                }
            }

            Console.WriteLine(result);
            //Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace codeforces
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			string[] s = Console.ReadLine ().Split (' ');
			long a = long.Parse (s [0]);
			long b = long.Parse (s [1]);

			long A = a, B = b;
			int m = 0, n = 0;
			while (A!=0) {
				m++;
				A/=2;
			}
			while (B!=0) {
				n++;
				B/=2;
			}
			int Q_m = 0, Q_n = 0;
			for (int i = 1; i <=m-2; i++)
				Q_m += i;
			long S1 = (long)Math.Pow (2, m) - 1;
			for (int i = 1; i <=m-1; i++) {
				if (S1 - (long)Math.Pow (2, m - i - 1) < a)
					Q_m++;
				else
					break;
			}
			for (int i = 1; i <=n-2; i++)
				Q_n += i;
			long S2 = (long)Math.Pow (2, n) - 1;
			for (int i = 1; i <=n-1; i++) {
				if (S2 - (long)Math.Pow (2, n - i - 1) <= b)
					Q_n++;
				else
					break;
			}
			Console.WriteLine (Q_n-Q_m);
		}
	}
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

namespace gb16_2
{
	class Program
	{
		static string _inputFilename = "in.txt";
		static string _outputFilename = "out.txt";
		static bool _useFileInput = false;

		static int n;
		static int m;

		static int[] a;
		static int[] b;

		static void Main(string[] args)
		{
			StreamWriter file = null;
			if (_useFileInput)
			{
				Console.SetIn(File.OpenText(_inputFilename));
				file = new StreamWriter(_outputFilename);
				Console.SetOut(file);
			}

#if DEBUG
			if (!_useFileInput)
			{
				Console.SetIn(getInput());
			}
#endif

			#region SOLUTION
			var d = readLongArray();
			var f = d[0];
			var s = d[1];

			var fc = getCount(f, false);
			var sc = getCount(s, true);

			var res = sc - fc;
			Console.WriteLine(res);

			//n = readInt();
			//m = readInt();

			//a = readIntArray();
			//b = readIntArray();
			#endregion

			if (_useFileInput)
			{
				file.Close();
			}
		}

		static int getCount(long f, bool include)
		{
			var fa = new long[65];
			for (int i = 0; i < 65; i++)
			{
				fa[i] = -1;
			}

			var j = 0;
			var zc = 0;
			while (true)
			{
				if (f == 0)
				{
					break;
				}

				var r = f % 2;
				fa[j] = r;
				if (r == 0)
				{
					zc++;
				}
				f = f / 2;

				j++;
			}

			var bar = -1;
			for (int i = j - 1; i >= 0; i--)
			{
				if (fa[i] == 0)
				{
					bar = i;
					break;
				}
			}

			var sc = 0;
			if (zc == 1 && include)
			{
				sc++;
			}

			if (bar == -1)
			{
				sc += j - 1;
			}
			else
			{
				sc += j - 1 - (bar + 1);
			}

			sc += (j - 2) * (j - 1) / 2;
			return sc;
		}

		static int readInt()
		{
			return int.Parse(Console.ReadLine());
		}

		static long readLong()
		{
			return long.Parse(Console.ReadLine());
		}

		static int[] readIntArray()
		{
			return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
		}

		static long[] readLongArray()
		{
			return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
		}

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]), b = long.Parse(s[1]);
            int p1 = 0;
            int ans = 0;
            long[] pow = new long[62];
            pow[0] = 1;
            for (int i = 1; i <= 61; i++) {
                pow[i] = 2 * pow[i - 1];
            }
            while (p1 <= 60) {
                p1++;
                for (int p2 = 0; p2 < p1 - 1; p2++) {
                    long nr = pow[p1] - 1 - pow[p2];
                    if (nr >= a && nr <= b) {
                        //Console.WriteLine("{0} {1} {2}",nr,n,p2);
                        ans++;
                    }
                }
            }
            Console.Write(ans);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int cnt=0;
		int mb=0;
		for(int j=63;j>=0;j--){
			if((b>>j)>0){mb=j;break;}
		}
		int ma=0;
		for(int j=63;j>=0;j--){
			if((a>>j)>0){ma=j;break;}
		}

		for(int j=ma;j<=mb;j++){
//Console.WriteLine("j="+j);
			long x=0;
			for(int i=0;i<=j;i++){x|=(1L<<i);}
//Console.WriteLine(Convert.ToString(x,2));
			for(int i=0;i<j;i++){
				long xx=x;
				xx^=(1L<<i);
//Console.WriteLine(Convert.ToString(xx,2));
				if(a<=xx &&xx<=b)cnt++;
			}
		}
		Console.WriteLine(cnt);

	}
	long a,b;
	public Sol(){
		var d=rla();
		a=d[0];b=d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections;
using System.ComponentModel;
using System.Linq;

public static partial class Program
{
	public static void Main(string[] args)
	{
		long[] vars = ParseArray<long>();
		long a = vars[0];
		long b = vars[1];
		Console.WriteLine(Function(a, b));

#if DEBUG
		Console.ReadLine();
#endif
	}

	public static long Function(long a, long b)
	{
		long rv = 0;

		for (int i = 1; i < 64; i++)
		{
			BitArray bits = new BitArray(i);
			bits.Not();

			for (int j = 0; j < bits.Count - 1; j++)
			{
				bits[j] = false;
				long x = GetIntFromBitArray(bits);

				if (x >= a && x <= b)
				{
					rv += 1;
				}

				bits[j] = true;
			}
		}

		return rv;
	}

	public static long GetIntFromBitArray(BitArray bitArray)
	{
		long value = 0;

		for (int i = 0; i < bitArray.Count; i++)
		{
			if (bitArray[i])
			{
				value += Convert.ToInt64(Math.Pow(2, i));
			}
		}

		return value;
	}
}

public static partial class Program
{
	public static T[] ParseArray<T>()
	{
		TypeConverter tc = TypeDescriptor.GetConverter(typeof(T));
		string[] input = Console.ReadLine().Split();
		T[] output = new T[input.Length];
		for (long i = 0; i < input.Length; i++) { output[i] = (T)tc.ConvertFromString(input[i]); }
		return output;
	}

	public static T[][] ParseMatrix<T>(long nrows)
	{
		T[][] rv = new T[nrows][];
		for (long i = 0; i < nrows; i++) { rv[i] = ParseArray<T>(); }
		return rv;
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace goodbye2015
{
    class Program
    {
        static UInt64 YesNo(UInt64 n)
        {
            if (n == 2) return 1;
            UInt64 step = 1;
            UInt64 kol = 0, ans = 0;
            while (step * 2 < n)
            {
                step *= 2;
                kol++;
                ans += (kol - 1);
            }
            step = 2 * step - 1;
            UInt64 newstep = 1;
            for (UInt64 i = 0; i < kol; i++)
            {
                if (step - newstep <= n) ans++;
                newstep *= 2;
            }
            return ans;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            UInt64 a = Convert.ToUInt64(s[0]);
            UInt64 b = Convert.ToUInt64(s[1]);
            UInt64 tmp = YesNo(a-1);
            UInt64 tmp1 = YesNo(b);
            Console.WriteLine(tmp1-tmp);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CFTraining.GoodBye2015
{
    class OldProperyB
    {
        public static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            ulong a = ulong.Parse(line[0]), b = ulong.Parse(line[1]) + 1;
            int remA = NumOfRemaining(Convert.ToString((long)a, 2)), remB = NumOfRemaining(Convert.ToString((long)b, 2));
            Console.WriteLine(remA - remB);
        }
        public static int NumOfRemaining(string str)
        {
            int i;
            for (i = 0; i < str.Length; i++) if (str[i] == '0') break;
            string remaining = "";
            if (i < str.Length) remaining = str.Substring(i);
            int rem = remaining.Length;
            for (i = str.Length + 1; i < 62; i++) rem += i - 1;
            return rem;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class CF338_1
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\1.txt"));

            string strT = Console.ReadLine();
            string[] strParams = strT.Split(new char[] { ' ' });
            ulong a = ulong.Parse(strParams[0]);
            ulong b = ulong.Parse(strParams[1]);

            int i = 0;
            ulong s = 0;

            while ((s = (ulong)Math.Pow(2, i)) <= b)
            {
                i++;
            }

            s--;
            i -= 2 ;
            ulong r = 0;
            while (s > a)
            {
                for (int j = i; j >= 0; j--)
                {
                    ulong t = (ulong)Math.Pow(2, j);
                    t = s - t;
                    if (t >= a && t <= b)
                        r++;
                }
                s = s >> 1;
                i--;
            }

            Console.WriteLine(r.ToString());
        }

    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        long a = ReadLong();
        long b = ReadLong();

        int ans = 0;
        for (int n = 2; n < 61; n++)
        {
            long x = (1L << n) - 1;
            for (int j = 0; j + 1 < n; j++)
            {
                long y = x ^ 1L << j;
                if (y >= a && y <= b)
                    ans++;
            }
        }

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("duty.in");
        //writer = new StreamWriter("duty.out");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] tokens = input.Split(' ');
            long a = long.Parse(tokens[0]);
            long b = long.Parse(tokens[1]);

            Console.WriteLine(Cal(b) - Cal(a - 1));
        }

        static long Cal(long i)
        {
            long r = 0;

            if (i <= 1)
            {
                return 0;
            }

            long b = 1;
            long n = 0;
            while (i/2 >= b)
            {
                ++n;
                b *= 2;
            }

            r = n*(n - 1)/2;

            long d = b / 2 - 1;
            bool f = true;
            while (b + d <= i)
            {
                ++r;
                b += d;

                if (f)
                {
                    ++d;
                    f = false;
                }
                d /= 2;

                if (d == 0)
                {
                    break;
                }
            }

            return r;
        }
    }
}

using System;
using System.Text;
using System.Collections.Generic;

public class Test
{
    public static void Main()
    {
        // your code goes here
        string input;
        long numa,numb,count = 0;

        input = Console.ReadLine();

        string inputa = input.Split(' ')[0];
        string inputb = input.Split(' ')[1];
        numa = Convert.ToInt64(inputa);
        numb = Convert.ToInt64(inputb);

        string low = Convert.ToString(numa, 2);
        string high = Convert.ToString(numb, 2);

        int lena = low.Length;
        int lenb = high.Length;

        StringBuilder temp = new StringBuilder();

        for(int i=0;i<lena;i++)
        {
            temp.Append("1");
        }

        for(int i=lena;i<=lenb;i++)
        {
            for(int j=i-1;j>0;j--)
            {
                if(j!=i-1)
                    temp[j+1] = '1';
                temp[j]='0';
            //  Console.WriteLine(temp);
                long num = Convert.ToInt64(temp.ToString(),2);
                if(num>= numa && num <=numb)
                {
                /*  int tempCount = 0;

                    for(int k =0;k<temp.Length;k++)
                    {
                        if(temp[k] == '0')
                            tempCount++;
                    }
                    if(tempCount != 1)
                        Console.WriteLine(num); */

                    count++;
                }
            }
            if(i!=1)
                temp[1] = '1';
            temp.Insert(0,"1");
        }
        Console.WriteLine(count);

    }
}

using System;
using System.Text;

namespace _2015B {
    class Program {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split(' ');
            ulong first = ulong.Parse(input[0]);
            ulong last = ulong.Parse(input[1]);
            int res = 0;
            ulong tmp = 0;
            string fS = DecimalToBinary(first);
            string lS = DecimalToBinary(last);

            for (int i = fS.Length; i <= lS.Length; i++)
                for (int j = 1; j < i; j++) {
                    tmp = BuildTest(i, j);
                    if (tmp <= last) {
                        if (tmp >= first)
                            res++;
                    } else
                        break;
                }

            Console.WriteLine(res);
        }

        static string DecimalToBinary(ulong data) {
            StringBuilder result = new StringBuilder();
            int rem = 0;
            while (data > 0) {
                rem = (int)(data % 2);
                data = data >> 1;
                result.Append(rem);
            }
            return ReverseString(result.ToString());
        }

        static string ReverseString(string s) {
            char[] arr = s.ToCharArray();
            Array.Reverse(arr);
            return new string(arr);
        }

        static ulong BuildTest(int length, int index) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < length - 1; i++) {
                sb.Append('1');
            }
            sb.Insert(index, '0');
            return (BinToDec(sb.ToString()));
        }

        static ulong BinToDec(string value) {
            ulong res = 0;
            foreach (char c in value) {
                res <<= 1;
                res += (ulong)(c == '1' ? 1 : 0);
            }
            return res;
        }
    }
}

using System;

class Program
{
    private static void Main(string[] args)
    {
        string s = Console.ReadLine();
        var arr = s.Split(' ');
        ulong n1 = ulong.Parse(arr[0]);
        ulong n2 = ulong.Parse(arr[1]);

        ulong sum = 0;

        ulong ulong1 = 1;
        for (int i = 2; i <= 63; i++)
        {
            ulong all1 = ulong1 << i;
            all1--;
            for (int j = 0; j < i - 1; j++)
            {
                ulong x = all1 ^ (ulong1 << j);
                if (n2 >= x && n1 <= x) sum++;
            }
        }

        Console.WriteLine(sum);
    }
}

/*

*/

using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Text;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Point
		{
			public int x;

			public double p;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/

			var s = GetString();
			var x = long.Parse(s.Split(' ')[0]);
			var y = long.Parse(s.Split(' ')[1]);
			var ans = 0;
			long p = 1;
			while (p <= 2*y)
			{
				long p1 = p - 1;
				long q = 1;
				while (p1 >= x && q * 2 < p)
				{
					if (p1 - q >= x && p1 - q <= y)
						ans++;
					q *= 2;
				}
				p *= 2;
			}
			Console.WriteLine(ans);

			/*			input.Close();
			output.Close();*/
		}
	}
}

using System;
using System.Linq;

namespace _611B
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Select(decimal.Parse).ToArray();
            var a = s[0] - 1; var b = s[1];
            Console.WriteLine(Calc(b) - Calc(a));

        }
        static decimal Calc(decimal num)
        {
            int n = Convert.ToString((long)num,2).Length;
            decimal max = n * (n - 1) / 2;
            for (int k=0; k<n;k++)
            {
                if (Pow(2, n) - 1 - Pow(2, k) > num) max--;
                else break;
            }
            return max;
        }
        static decimal Pow(decimal num, int power)
        {
            if (power == 0) return 1;
            if (power == 1) return num;
            decimal output = num;
            for (int i=1;i<power;i++)
            {
                output *= num;
            }
            return output;
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;

class Program
{
    private static long[] pow2 = new long[64];
    private static int Iterate(long a, long b, int size)
    {
        long mask = pow2[size] - 1;

        int ans = 0;
        for(int i=0;i<size - 1;i++)
        {
            long x = mask ^ pow2[i];
            if (a <= x && x <= b)
            {
                ans++;
            }
        }

        return ans;
    }

    static void Main(string[] args)
    {
        long a = ReadLong();
        long b = ReadLong();

        pow2[0] = 1;
        for (int i = 1; i < pow2.Length; i++) pow2[i] = pow2[i - 1] * 2;

        int ans = 0;
        for (int i = 1; i < 64; i++)
            ans += Iterate(a, b, i);

        Console.WriteLine(ans);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n + 1];
        for (int i = 0; i <= n; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);

    private static int ReadInt()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong ReadULong()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long ReadLong()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] ReadIntArray(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadInt();
        return ans;
    }

    private static long[] ReadLongArray(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadLong();
        return ans;
    }

    private static char[] ReadString()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans < 'a' || ans > 'z');

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans >= 'a' && ans <= 'z');

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans < 'a' || ans > 'z');

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            ans = consoleReader.Read();
        } while (ans >= 'a' && ans <= 'z');

        return s;
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans - (int)'0';
        }
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _611B
    {
        public static void Main()
        {
            string[] tokens = Console.ReadLine().Split();

            long a = long.Parse(tokens[0]);
            long b = long.Parse(tokens[1]);

            int count = 0;

            for (int length = 1; length < 64; length++)
            {
                for (int i = length == 1 ? 0 : 1; i < length; i++)
                {
                    char[] chars = Enumerable.Repeat('1', length).ToArray();
                    chars[i] = '0';

                    long n = Convert.ToInt64(new string(chars), 2);
                    if (a <= n && n <= b)
                    {
                        count++;
                    }
                }
            }

            Console.WriteLine(count);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static ulong result = 0;
        static ulong a, b;
        static void getResult(ulong current, ulong zeroCount)
        {
            if (current > b)
                return;
            if (current >= a && current <= b && zeroCount == 1)
                result++;
            if (zeroCount == 0)
            {
                getResult(current * 2, zeroCount + 1);
            }
            getResult(current * 2 + 1, zeroCount);
        }
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            a = Convert.ToUInt64(input[0]);
            b = Convert.ToUInt64(input[1]);
            getResult(1, 0);
            Console.WriteLine(result);
        }
    }
}

using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
using Number = System.Int64;

namespace Program
{

    public class Solver
    {
        public void Solve()
        {
            var a = sc.Long() - 1;
            var b = sc.Long();
            var B = f(b);
            var A = f(a);
            Debug.WriteLine(A);
            Debug.WriteLine(B);
            IO.Printer.Out.WriteLine(f(b) - f(a));
        }
        public long f(long v)
        {
            if (v == 0) return 1;

            var h = 0;
            for (int i = 0; i < 60; i++)
                if ((v >> i & 1) == 1) h = i;
            var ans = 0L;
            for (int i = 1; i < h; i++)
                ans += i - 1;

            var dp = new long[3, 2];
            dp[0, 1] = 1;
            for (int i = h - 1; i >= 0; i--)
            {
                var next = new long[3, 2];

                if ((v >> i & 1) == 1)
                {
                    next[0, 1] += dp[0, 1];
                    next[1, 1] += dp[1, 1];
                    next[1, 0] += dp[0, 1];
                }
                else
                {
                    next[1, 1] += dp[0, 1];
                }
                next[0, 0] += 1;
                next[0, 0] += dp[0, 0];
                next[1, 0] += dp[0, 0];
                next[1, 0] += dp[1, 0];
                dp = next;
            }

            return dp[1, 0] + dp[1, 1];
        }

        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != 0 && b != '-' && (b < '0' || '9' < b));
            if (b == 0) return long.MinValue;
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { var s = Scan(); return s != "" ? double.Parse(Scan(), CultureInfo.InvariantCulture) : double.NaN; }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion

using System;
using System.Linq;

namespace Test
{
    static class Program
    {
        static void Main(string[] args)
        {
            string temp = Console.ReadLine();
            long[] temps = temp.Split(new[] { " " }, StringSplitOptions.None).Select(long.Parse).ToArray();
            string s1 = Convert.ToString(temps[0], 2);
            string s2 = Convert.ToString(temps[1], 2);
            s1 = FindNext(s1);
            s2 = FindPrev(s2);
            Console.WriteLine(Count(s1, s2));
        }

        static int Count(string s1, string s2)
        {
            long l1 = Convert.ToInt64(s1, 2);
            long l2 = Convert.ToInt64(s2, 2);
            if (l1 > l2) return 0;
            if (l1 == l2) return 1;

            int total = 0;
            int iS = s1.Length;
            int iE = s2.Length;
            int i1 = s1.IndexOf("0");
            int i2 = s2.IndexOf("0");
            if (iS == iE) return i2 - i1 + 1;
            total += iS - i1;
            total += i2;
            for (int i = iS + 1; i < iE; i++) total += i - 1;
            return total;
        }

        static string FindNext(string s)
        {
            string t;
            int index = s.IndexOf("0");
            if (index != -1)
            {
                int iindex = s.IndexOf("0", index + 1);
                if (iindex == -1) return s;
                t = s.Remove(index + 1);
                for (int i = index + 1; i < s.Length; i++) t += "1";
                return t;
            }
            t = "10";
            for (int i = 1; i < s.Length; i++) t += "1";
            return t;
        }

        static string FindPrev(string s)
        {
            if (s.Equals("10")) return "1";
            string t = null;
            int index = s.IndexOf("0");
            if (index != -1)
            {
                int iindex = s.IndexOf("0", index + 1);
                if (iindex == -1) return s;
                for (int i = 0; i < index - 1; i++) t += "1";
                t += "0";
                for (int i = index; i < s.Length; i++) t += "1";
                return t;
            }
            t = s.Remove(s.Length - 1) + "0";
            return t;
        }
    }
}

using System;
using System.Linq;

namespace Test
{
    static class Program
    {
        static void Main(string[] args)
        {
            string temp = Console.ReadLine();
            long[] temps = temp.Split(new[] { " " }, StringSplitOptions.None).Select(long.Parse).ToArray();
            string s1 = Convert.ToString(temps[0], 2);
            string s2 = Convert.ToString(temps[1], 2);
            s1 = FindNext(s1);
            s2 = FindPrev(s2);
            Console.WriteLine(Count(s1, s2));
        }

        static int Count(string s1, string s2)
        {
            long l1 = Convert.ToInt64(s1, 2);
            long l2 = Convert.ToInt64(s2, 2);
            if (l1 > l2) return 0;
            if (l1 == l2) return 1;

            int total = 0;
            int iS = s1.Length;
            int iE = s2.Length;
            int i1 = s1.IndexOf("0");
            int i2 = s2.IndexOf("0");
            if (iS == iE) return i2 - i1 + 1;
            total += iS - i1;
            total += i2;
            for (int i = iS + 1; i < iE; i++) total += i-1;
            return total;
        }

        static string FindNext(string s)
        {
            string t;
            int index = s.IndexOf("0");
            if (index != -1)
            {
                int iindex = s.IndexOf("0", index + 1);
                if (iindex == -1) return s;
                t = s.Remove(index + 1);
                for (int i = index + 1; i < s.Length; i++) t += "1";
                return t;
            }
            t = "10";
            for (int i = 1; i < s.Length; i++) t += "1";
            return t;
        }

        static string FindPrev(string s)
        {
            if (s.Equals("10")) return "1";
            string t = null;
            int index = s.IndexOf("0");
            if (index != -1)
            {
                int iindex = s.IndexOf("0", index + 1);
                if (iindex == -1) return s;
                for (int i = index + 1; i < s.Length; i++) t += "1";
                t += "0";
                return t;
            }
            t = s.Remove(s.Length - 1) + "0";
            return t;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;

namespace Beresta
{

	class ContestIO : StreamWriter
	{
		public ContestIO() : base(Console.OpenStandardOutput(8192), Encoding.ASCII, 8192) { }
		//d.ToString("N12", CultureInfo.InvariantCulture).Replace(",", "")
		public StreamReader Reader = new StreamReader(Console.OpenStandardInput(8192), Encoding.ASCII, false, 8192);
		bool IsDigit(long c) { return c >= '0' && c <= '9'; }

		public long Read()
		{
			long c1 = 0, c;
			while (!IsDigit(c = Reader.Read())) { c1 = c; }
			long r = c - '0';
			while (IsDigit(c = Reader.Read()))
				r = r * 10 + c - '0';
			return c1 == '-' ? -r : r;
		}
	}

	class Program
	{

		static void Main(string[] args)
		{
			using (var io = new ContestIO())
			{
				var a = io.Read();
				var b = io.Read();

				var count = 0L;
				for (var i = 1; i <= 100; i++)
				{
					var v1 = (1L << i) - 1L;
					var v2 = v1 - 1;
					while (v2 != v1)
					{
						if (v2 >= a && v2 <= b)
							count++;
						v2 = ((v2 << 1) | 1) & v1;
					}
					if (v2 > b)
						break;
				}

				io.WriteLine(count);
			}

			Console.ReadLine();
		}

	}

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _611B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long a = long.Parse(input[0]), b = long.Parse(input[1]);
            long x = 1; int power = 0;
            while (x < a)
            {
                x <<= 1;
                power++;
            }

            bool flag = true;
            long result = 0;
            HashSet<long> hashset = new HashSet<long>();
            while (flag)
            {
                x -= 1;
                for (int i = power - 2; i >= 0; i--)
                {
                    long y = x - (1 << i);
                    if (i == power - 2 && y > b)
                    {
                        flag = false;
                        break;
                    }
                    else if (y >= a && y <= b && !hashset.Contains(y))
                    {
                        result++;
                        hashset.Add(y);
                    }
                }
                x += 1;
                x <<= 1;
                power++;
            }

            Console.WriteLine(result);
            //Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]), b = long.Parse(s[1]);
            long n = 1;
            int p1 = 0;
            int ans = 0;
            while (p1 <= 60) {
                n <<= 1;
                p1++;
                for (int p2 = 0; p2 < p1 - 1; p2++) {
                    long nr = n - 1 - (1 << p2);
                    if (nr >= a && nr <= b) {
                        //Console.WriteLine("{0} {1} {2}",nr,n,p2);
                        ans++;
                    }
                }
            }
            Console.Write(ans);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int cnt=0;
		int mb=0;
		long bb=b;
		while(b>0){b/=2;mb++;}
		mb-=2;
		long aa=a;
		int ma=0;
		while(a>0){a/=2;ma++;}
		ma-=2;

		for(int j=ma;j<=mb;j++){
//Console.WriteLine("j="+j);
			long x=0;
			for(int i=0;i<=j;i++){x|=1;x<<=1;}
			x|=1;
//Console.WriteLine(x);
			for(int i=0;i<=j+1;i++){
				x^=(1<<i);
				if(a<=x &&x<=b)cnt++;
			}
		}
		Console.WriteLine(cnt);

	}
	long a,b;
	public Sol(){
		var d=rla();
		a=d[0];b=d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int cnt=0;
		int mb=0;
		for(int j=63;j>=0;j--){
			if((b>>j)>0){mb=j;break;}
		}
		int ma=0;
		for(int j=63;j>=0;j--){
			if((a>>j)>0){ma=j;break;}
		}

		for(int j=ma;j<=mb;j++){
//Console.WriteLine("j="+j);
			long x=0;
			for(int i=0;i<=j;i++){x|=(1L<<i);}
//Console.WriteLine(x);
			for(int i=0;i<j;i++){
				long xx=x;
				xx^=(1<<i);
				if(a<=xx &&xx<=b)cnt++;
			}
		}
		Console.WriteLine(cnt);

	}
	long a,b;
	public Sol(){
		var d=rla();
		a=d[0];b=d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int cnt=0;
		int mb=0;
		for(int j=63;j>=0;j--){
			if((b>>j)>0){mb=j;break;}
		}
		int ma=0;
		for(int j=63;j>=0;j--){
			if((a>>j)>0){ma=j;break;}
		}

		for(int j=ma;j<=mb;j++){
//Console.WriteLine("j="+j);
			long x=0;
			for(int i=0;i<=j;i++){x|=(1L<<i);}
//Console.WriteLine(x);
			for(int i=0;i<=j;i++){
				long xx=x;
				xx^=(1<<i);
				if(a<=xx &&xx<=b)cnt++;
			}
		}
		Console.WriteLine(cnt);

	}
	long a,b;
	public Sol(){
		var d=rla();
		a=d[0];b=d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int cnt=0;
		int mb=0;
		for(int j=63;j>=0;j--){
			if((b>>j)>0){mb=j;break;}
		}
		int ma=0;
		for(int j=63;j>=0;j--){
			if((a>>j)>0){ma=j;break;}
		}

		for(int j=ma;j<=mb;j++){
//Console.WriteLine("j="+j);
			long x=0;
			for(int i=0;i<=j;i++){x|=(1L<<i);}
//Console.WriteLine(x);
			for(int i=0;i<=j;i++){
				x^=(1<<i);
				if(a<=x &&x<=b)cnt++;
			}
		}
		Console.WriteLine(cnt);

	}
	long a,b;
	public Sol(){
		var d=rla();
		a=d[0];b=d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace goodbye2015
{
    class Program
    {
        static UInt64 YesNo(UInt64 n)
        {
            UInt64 step = 1;
            UInt64 kol = 0, ans = 0;
            while (step * 2 < n)
            {
                step *= 2;
                kol++;
                ans += (kol - 1);
            }
            step = 2 * step - 1;
            UInt64 newstep = 1;
            for (UInt64 i = 0; i < kol; i++)
            {
                if (step - newstep <= n) ans++;
                newstep *= 2;
            }
            return ans;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            UInt64 a = Convert.ToUInt64(s[0]);
            UInt64 b = Convert.ToUInt64(s[1]);
            UInt64 tmp = YesNo(a-1);
            UInt64 tmp1 = YesNo(b);
            Console.WriteLine(tmp1-tmp);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CFTraining.GoodBye2015
{
    class OldProperyB
    {
        public static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            ulong a = ulong.Parse(line[0]), b = ulong.Parse(line[1]);
            int remA = NumOfRemaining(Convert.ToString((long)a, 2)) + (isSpecial(line[0]) ? 1 : 0), remB = NumOfRemaining(Convert.ToString((long)b, 2));
            Console.WriteLine(remA - remB);
        }
        public static int NumOfRemaining(string str)
        {
            int i;
            for (i = 0; i < str.Length; i++) if (str[i] == '0') break;
            string remaining = "";
            if (i < str.Length) remaining = str.Substring(i);
            int rem = remaining.Length;
            for (i = str.Length + 1; i < 62; i++)
            {
                rem += i - 1;
            }
            return rem;
        }
        public static bool isSpecial(string str)
        {
            int count = 0;
            foreach (char c in str)
            {
                if (c == '0') count++;
            }
            return str.Length > 0 && count == 1;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] tokens = input.Split(' ');
            long a = long.Parse(tokens[0]);
            long b = long.Parse(tokens[1]);

            Console.WriteLine(Cal(b) - Cal(a - 1));
        }

        static long Cal(long i)
        {
            long r = 0;

            if (i <= 1)
            {
                return 0;
            }

            long b = 1;
            long n = 0;
            while (i/2 >= b)
            {
                ++n;
                b *= 2;
            }

            r = n*(n - 1)/2;

            long d = b / 2 - 1;
            while (b + d <= i)
            {
                ++r;
                b += d;

                if (d%2 == 1 && d != 1)
                {
                    ++d;
                }
                d /= 2;

                if (d == 0)
                {
                    break;
                }
            }

            return r;
        }
    }
}

using System;
using System.Text;

public class Test
{
    public static void Main()
    {
        // your code goes here
        string input;
        long numa,numb,count = 0;

        input = Console.ReadLine();

        string inputa = input.Split(' ')[0];
        string inputb = input.Split(' ')[1];
        numa = Convert.ToInt64(inputa);
        numb = Convert.ToInt64(inputb);

        string low = Convert.ToString(numa, 2);
        string high = Convert.ToString(numb, 2);

        int lena = low.Length;
        int lenb = high.Length;

        StringBuilder temp = new StringBuilder();

        for(int i=0;i<lena;i++)
        {
            temp.Append("1");
        }
    //  Console.WriteLine(lena);
    //  Console.WriteLine(lenb);
        for(int i=lena;i<=lenb;i++)
        {
            for(int j=i-1;j>0;j--)
            {
                if(j!=i-1)
                    temp[j+1] = '1';
                temp[j]='0';
                long num = Convert.ToInt64(temp.ToString(),2);
                if(num>= numa && num <=numb)
                {
                    count++;
                }
            }
            temp.Insert(0,"1");
        }
        Console.WriteLine(count);

    }
}

using System;
using System.Text;

namespace _2015B {
    class Program {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split(' ');
            ulong first = ulong.Parse(input[0]);
            ulong last = ulong.Parse(input[1]);
            int res = 0;
            ulong tmp;
            string fS = DecimalToBinary(first);
            string lS = DecimalToBinary(last);

            for (int i = fS.Length; i <= lS.Length; i++)
                for (int j = 0; j < i; j++) {
                    tmp = BuildTest(i, j);
                    if (tmp <= last) {
                        if (tmp >= first)
                            res++;
                    } else
                        break;
                }

            Console.WriteLine(res);
        }

        static string DecimalToBinary(ulong data) {
            StringBuilder result = new StringBuilder();
            int rem = 0;
            while (data > 0) {
                rem = (int)(data % 2);
                data = data >> 1;
                result.Append(rem);
            }
            return ReverseString(result.ToString());
        }

        static string ReverseString(string s) {
            char[] arr = s.ToCharArray();
            Array.Reverse(arr);
            return new string(arr);
        }

        static ulong BuildTest(int length, int index) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < length - 1; i++) {
                sb.Append('1');
            }
            sb.Insert(length - index - 1, '0');
            return (BinToDec(sb.ToString()));
        }

        static ulong BinToDec(string value) {
            ulong res = 0;
            foreach (char c in value) {
                res <<= 1;
                res += (ulong)(c == '1' ? 1 : 0);
            }
            return res;
        }
    }
}

using System;
using System.Text;

namespace _2015B {
    class Program {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split(' ');
            ulong first = ulong.Parse(input[0]);
            ulong last = ulong.Parse(input[1]);
            int count1 = 0;
            int res = 0;
            ulong tmp;
            string fS = DecimalToBinary(first);
            string lS = DecimalToBinary(last);
            if (lS.Length > fS.Length) {
                foreach (char c in fS) {
                    if (c == '1')
                        count1++;
                    else
                        break;
                }
                res = fS.Length - count1 - 1;
                for (int i = 0; i < lS.Length; i++) {
                    if (BuildTest(lS.Length, i) < last)
                        res++;
                    else
                        break;
                }
            } else {
                for (int i = 0; i < lS.Length; i++) {
                    tmp = BuildTest(lS.Length, i);
                    if (tmp <= last) {
                        if (tmp >= first)
                            res++;
                    } else
                        break;
                }
            }
            Console.WriteLine(res);
        }

        static string DecimalToBinary(ulong data) {
            StringBuilder result = new StringBuilder();
            int rem = 0;
            while (data > 0) {
                rem = (int)(data % 2);
                data = data >> 1;
                result.Append(rem);
            }
            return ReverseString(result.ToString());
        }

        static string ReverseString(string s) {
            char[] arr = s.ToCharArray();
            Array.Reverse(arr);
            return new string(arr);
        }

        static ulong BuildTest(int length, int index) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < length - 1; i++) {
                sb.Append('1');
            }
            sb.Insert(index, '0');
            return (BinToDec(sb.ToString()));
        }

        static ulong BinToDec(string value) {
            ulong res = 0;
            foreach (char c in value) {
                res <<= 1;
                res += (ulong)(c == '1' ? 1 : 0);
            }
            return res;
        }
    }
}

using System;
using System.Linq;

namespace _611B
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var a = s[0] - 1; var b = s[1];
            Console.WriteLine(Calc(b)-Calc(a));
        }
        static long Calc(long num)
        {
            int n = Convert.ToString(num, 2).Length;
            long max = n * (n - 1) / 2;
            for (int k=0; k<n;k++)
            {
                if (Math.Pow(2, n) - 1 - Math.Pow(2, k) > num) max--;
                else break;
            }
            return max;
        }
    }
}