def bit_count(x): return bin(x).count('1') def beauty_of_number(N): MOD = 1000000007 return bit_count(N) % MOD def main(): import sys input = sys.stdin.read data = input().strip() N = int(data) result = beauty_of_number(N) print(result) if __name__ == "__main__": main()