The wife of a man became very sick. On her deathbed, she said to him, "I love you so much! I don't want to leave you, and I don't want you to betray me. Promise that you will not see any other women once I die, or I will come back to haunt you."
For several months after her death, the husband did avoid other women, but then he met someone and fell in love. On the night that they were engaged to be married, the ghost of his former wife appeared to him. She blamed him for not keeping the promise, and every night thereafter she returned to taunt him. The ghost would remind him of everything that transpired between him and his fiancee that day, even to the point of repeating, word for word, their conversations. It upset him so badly that he couldn't sleep at all.
Desperate, he sought the advice of a Zen master who lived near the village. "This is a very clever ghost," the master said upon hearing the man's story. "It is!" replied the man. "She remembers every detail of what I say and do. It knows everything!" The master smiled, "You should admire such a ghost, but I will tell you what to do the next time you see it."
That night the ghost returned. The man responded just as the master had advised. "You are such a wise ghost," the man said, "You know that I can hide nothing from you. If you can answer me one question, I will break off the engagement and remain single for the rest of my life." "Ask your question," the ghost replied. The man scooped up a handful of beans from a large bag on the floor, "Tell me exactly how many beans there are in my hand."
At that moment the ghost disappeared and never returned.