#include using namespace std; using ll=long long; ll MOD; namespace Lib{ ll modpow(ll a,ll n){ long long ret=1,t=a; while(n>0){ if(n&1)ret=ret*t%MOD; t=t*t%MOD; n/=2; } return ret; } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll N,P,Q; cin>>N>>P>>Q; MOD=P; vector A(N,0); for(int &i:A)cin>>i; sort(A.begin(),A.end()); mapcnt; ll ans=0; for(int c=N-1;c>=0;c--){ for(int a=0;a