#include #include #include using namespace std; int data[101], n, b, c; bool judge(int i, int j) { if (abs(data[i]-data[j])%b == c) return true; return false; } int main() { int i, j, ret; while (scanf("%d%d%d", &n, &b, &c) != EOF) { for (i = 0; i < n; i++) scanf("%d", &data[i]); for (i = 0, ret = 0; i < n; i++) for (j = i+1; j < n; j++) if (judge(i, j)) ret++; printf("%d\n", ret); } }