Bhagavad Gita 2.15

यं हि न व्यथयन्तयेते पुरुषं पुरुषर्षभ |
समदुःखसुखं धीरें सोऽमृतत्वाय कल्पते

Translation

O Arjun, noblest amongst men, that person who is not affected by happiness and distress, and remains steady in both, becomes eligible for liberation.