Obsessions and compulsions may have some logical connection (eg, handwashing to avoid disease) or may be illogical and idiosyncratic (eg, counting to 50 over and over to prevent grandpa from having a heart attack).