Polycarpus analyzes a string called abracadabra. This string is constructed using the following algorithm: 
 -  On the first step the string consists of a single character "a". -  On the *k*-th step Polycarpus concatenates two copies of the string obtained on the (*k* - 1)-th step, while inserting the *k*-th character of the alphabet between them. Polycarpus uses the alphabet that consists of lowercase Latin letters and digits (a total of 36 characters). The alphabet characters are numbered like this: the 1-st character is "a", the 2-nd — "b", ..., the 26-th — "z", the 27-th — "0", the 28-th — "1", ..., the 36-th — "9". 
Let's have a closer look at the algorithm. On the second step Polycarpus will concatenate two strings "a" and insert the character "b" between them, resulting in "aba" string. The third step will transform it into "abacaba", and the fourth one - into "abacabadabacaba". Thus, the string constructed on the *k*-th step will consist of 2<sup class="upper-index">*k*</sup> - 1 characters. 

Polycarpus wrote down the string he got after 30 steps of the given algorithm and chose two non-empty substrings of it. Your task is to find the length of the longest common substring of the two substrings selected by Polycarpus.

A substring *s*[*i*... *j*] (1 ≤ *i* ≤ *j* ≤ |*s*|) of string *s* = *s*<sub class="lower-index">1</sub>*s*<sub class="lower-index">2</sub>... *s*<sub class="lower-index">|*s*|</sub> is a string *s*<sub class="lower-index">*i*</sub>*s*<sub class="lower-index">*i* + 1</sub>... *s*<sub class="lower-index">*j*</sub>. For example, substring *s*[2...4] of string *s* = "abacaba" equals "bac". The string is its own substring.

The longest common substring of two strings *s* and *t* is the longest string that is a substring of both *s* and *t*. For example, the longest common substring of "contest" and "systemtesting" is string "test". There can be several common substrings of maximum length.
The input consists of a single line containing four integers *l*<sub class="lower-index">1</sub>, *r*<sub class="lower-index">1</sub>, *l*<sub class="lower-index">2</sub>, *r*<sub class="lower-index">2</sub> (1 ≤ *l*<sub class="lower-index">*i*</sub> ≤ *r*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>, *i* = 1, 2). The numbers are separated by single spaces. *l*<sub class="lower-index">*i*</sub> and *r*<sub class="lower-index">*i*</sub> give the indices of the first and the last characters of the *i*-th chosen substring, correspondingly (*i* = 1, 2). The characters of string abracadabra are numbered starting from 1.
3 6 1 4
2
1 1 4 4
0
2 2 6 6
1
73426655 594361930 343984155 989446962
379149396
169720415 312105195 670978284 671296539
207899
1 1 1 1
1
1 1 2 3
1
2 3 1 1
1
4 5 6 7
1
5 6 5 10
2
20 59 93 97
5
59 797 761 863
103
3563 8248 1195 5811
2901
26733 47464 19138 46248
19516
183307 582175 813247 925985
112739
42765 7043311 3930802 8641200
4151539
48358214 56090000 19994986 77748608
7731787
326428072 910655768 241366302 856438517
530010446
1 1000000000 1 1000000000
1000000000
601080293 742283208 417827259 630484959
71194568
933937636 947664621 406658382 548532154
8140525
876260202 917475655 508441743 544698794
28429169
260267830 630246217 436204204 880818505
268435455
1 463129088 536870913 1000000000
463129088
1 463129088 536870914 1000000000
463129087
58660225 863918362 315894896 954309337
548023467
462616550 929253987 199885647 365920450
166034804
166724572 472113234 358126054 528083792
125430608
654444727 988815385 77276659 644738371
334370659
346539730 828420288 373318830 643522086
270203257
156642200 503020953 296806626 871864091
234585497
229012373 968585257 177685154 283692208
106007055
225343773 292960163 388346281 585652974
43091683
760202684 921630809 8799976 434695123
161428126
489816019 571947327 244679586 543875061
54059043
377544108 461895419 242140460 901355034
84351312
293057586 653835431 583814665 643163992
59349328
926028190 962292871 588752738 848484542
36264682
79844257 998861014 59606735 909001530
829157274
656438998 774335411 16384880 470969252
117896414
287551411 788248606 147317343 692683069
405131659
677764866 754506263 454018800 668014358
76741398
1 2 3 6
2
1 1 2 1000000000
1
5 7 13 15
3
1 3 5 7
3
1 3 9 11
3
5 7 1 3
3
1 4 4 7
3
4 7 12 15
4
1 4 9 12
4
4 7 1 4
3
3 3 1 2
1
1 2 3 3
1
3 4 1 2
1
8136 12821 10573 15189
2901
331458616 472661531 443256865 655914565
71194568
156266169 197481622 529043030 565300081
28429169
443495607 813473994 192923319 637537620
268435455
1 2 2 1000000000
2
1 3 4 1000000000
3
1 999999999 999999998 1000000000
3
l1, r1, l2, r2 = map(int, input().split())
la = set()
lb = set()
val = 1
result = 0
 
def solve(l, r, val, li):
    if l > r:
        return
    if (l, r) in li:
        return
    while val > 1 and (val - 1) / 2 >= r:
        val = (val - 1) / 2
    li.add((l, r))
    if val >= 3 and l <= r:
        val = (val - 1) / 2
        solve(l, min(val, r), val, li)
        solve(max(l - val - 1, 1), min(val, r - val - 1), val, li)
 

for i in range(32):
    val = val * 2 + 1

solve(l1, r1, val, la)
solve(l2, r2, val, lb)
 


for i in la:
    for j in lb:
        result = max(result, min(i[1], j[1]) - max(i[0], j[0]) + 1)

print(int(result))