`FP[ps[i]]++;` needs to be changed to `FP[p[i]]++;`
FP[ps[i]]++;needs to be changed toFP[p[i]]++;