This is in Anguttara Nikaya, 4.49:
https://tricycle.org/wp-content/themes/tricycle/download.php?file=MjAxNy8xMS9EdXJhbi1XZWVrLTEucGRm
"These four, [that follow, below] O Monks, are distortions of perception, distortions of thought, distortions of view:
[1] Sensing no change in the changing,
[2] Sensing pleasure in suffering,
[3] Assuming self where there is no self,
[4] Sensing the unlovely as lovely—
Gone astray with wrong views, beings
Misperceive with distorted minds.
Bound in the bondage of Mara,
Those people are far from safety.
They’re beings that go on flowing:
Going again from death to birth.
But when in the world of darkness
Buddhas arise to make things bright,
They present this profound teaching
Which brings suffering to an end.
When those with wisdom have heard this,
They recuperate their right mind:
They see change in what is changing,
Suffering where there’s suffering,
“Non-self” in what is without self,
They see the unlovely as such.
By this acceptance of right view,That is the Anguttara Nikaya’s Vipallasa Sutta, or the distortions of perception, thought, and view.
They overcome all suffering.”
https://tricycle.org/wp-content/themes/tricycle/download.php?file=MjAxNy8xMS9EdXJhbi1XZWVrLTEucGRm