def main(): s = input() print(int(s.replace("hamu", "1").replace("ham", "0"), base=2)) if __name__ == '__main__': main()