시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB77242960235641.832%

## 문제

두 자연수 A, B가 주어졌을 때, A ≤ x ≤ B를 만족하는 모든 x에 대해 x를 이진수로 표현했을 때 1의 개수의 합을 구하는 프로그램을 작성하시오.

즉, f(x) = x를 이진수로 표현 했을 때 1의 개수라고 정의하고, 아래 식의 결과를 구하자.

$\sum_{x=A}^{B}{f(x)}$

## 입력

첫 줄에 두 자연수 A, B가 주어진다. (1 ≤ A ≤ B ≤ 1016)

1의 개수를 세어 출력한다.

## 예제 입력 1

2 12


## 예제 출력 1

21

W3sicHJvYmxlbV9pZCI6Ijk1MjciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiIxXHVjNzU4IFx1YWMxY1x1YzIxOCBcdWMxMzhcdWFlMzAiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YjQ1MCBcdWM3OTBcdWM1ZjBcdWMyMTggQSwgQlx1YWMwMCBcdWM4ZmNcdWM1YjRcdWM4NGNcdWM3NDQgXHViNTRjLCBBJm5ic3A7JmxlOyB4Jm5ic3A7JmxlOyBCXHViOTdjIFx1YjljY1x1Yzg3MVx1ZDU1OFx1YjI5NCBcdWJhYThcdWI0ZTAgeFx1YzVkMCBcdWIzMDBcdWQ1NzQgeFx1Yjk3YyZuYnNwO1x1Yzc3NFx1YzljNFx1YzIxOFx1Yjg1YyBcdWQ0NWNcdWQ2MDRcdWQ1ODhcdWM3NDQgXHViNTRjIDFcdWM3NTggXHVhYzFjXHVjMjE4XHVjNzU4IFx1ZDU2OVx1Yzc0NCBcdWFkNmNcdWQ1NThcdWIyOTQgXHVkNTA0XHViODVjXHVhZGY4XHViN2E4XHVjNzQ0IFx1Yzc5MVx1YzEzMVx1ZDU1OFx1YzJkY1x1YzYyNC48XC9wPlxyXG5cclxuPHA+XHVjOTg5LCBmKHgpID0geFx1Yjk3YyBcdWM3NzRcdWM5YzRcdWMyMThcdWI4NWMgXHVkNDVjXHVkNjA0IFx1ZDU4O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GZldyBtaW51dGVzLCBoZSBjYW1lIGJhY2sgd2l0aCBhIGxpc3Qgb2YgdGhlIGJpbmFyeSByZXByZXNlbnRhdGlvbiBvZiBhbGwgdGhlIGludGVnZXJzIGZyb20gMSB0byAxMDAuICZsZHF1bztDYWVzYXIsIEkmcnNxdW87bSByZWFkeSZyZHF1bzsuIENhZXNhciBzbWlsZWQgYW5kIHNhaWQ6ICZsZHF1bztXZWxsLCBsZXQgbWUgc2VlLCBJIGNob29zZSBBID0gMTA8c3VwPjE1PFwvc3VwPiBhbmQgQiA9IDEwPHN1cD4xNjxcL3N1cD4uIFlvdXIgbGlzdCB3aWxsIG5vdCBiZSB1c2VmdWwmcmRxdW87LjxcL3A+XHJcblxyXG48cD5DYXJsIGhhdGVzIGxvb3NpbmcgdG8gaGlzIGJyb3RoZXIgc28gaGUgbmVlZHMgYSBiZXR0ZXIgc29sdXRpb24gZmFzdC4gQ2FuIHlvdSBoZWxwIGhpbT88XC9wPlxyXG4iLCJpbnB1dCI6IjxwPkEgc2luZ2xlIGxpbmUgdGhhdCBjb250YWlucyB0d28gaW50ZWdlcnMgQSBhbmQgQiAoMSAmbGU7IEEgJmxlOyBCICZsZTsgMTA8c3VwPjE2PFwvc3VwPikuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+T3V0cHV0IGEgbGluZSB3aXRoIGFuIGludGVnZXIgcmVwcmVzZW50aW5nIHRoZSB0b3RhbCBudW1iZXIgb2YgZGlnaXRzIDEgaW4gdGhlIGJpbmFyeSByZXByZXNlbnRhdGlvbiBvZiBhbGwgdGhlIGludGVnZXJzIGZyb20gQSB0byBCLCBpbmNsdXNpdmUuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsImh0bWxfdGl0bGUiOiIwIiwicHJvYmxlbV9sYW5nX3Rjb2RlIjoiRW5nbGlzaCJ9XQ==

## 출처

• 문제를 번역한 사람: myungwoo
• 문제를 만든 사람: Ray Williams Robinson Valiente