#include #include static int compar(const void *_a, const void *_b) { const int *a = _a; const int *b = _b; return *a - *b; } int main(void) { int list[256]; int len = 0; while (EOF != scanf("%d\n", &list[len])) { len++; } list[len++] = 0; qsort(list, len, sizeof(int), compar); list[len] = list[len-1] + 3; len++; int j1 = 0, j3 = 0; for (int i = 1; i < len; ++i) { if (list[i] - list[i-1] == 1) j1++; if (list[i] - list[i-1] == 3) j3++; } printf("%d\n", j1 * j3); }