#include #include #include void radix_sort64(uint64_t *a, int a_len) { uint64_t *work0 = (uint64_t *)calloc(0x10000, sizeof(uint64_t)); uint64_t *work1 = (uint64_t *)calloc(a_len, sizeof(uint64_t)); uint64_t *work2 = (uint64_t *)calloc(0x10000, sizeof(uint64_t)); #ifdef LOCAL if (work0 == NULL || work1 == NULL || work2 == NULL) exit(EXIT_FAILURE); #endif uint64_t shift = 0; __uint128_t x = 0; while (shift < 64ul) { memset(work2, 0, 0x10000 * sizeof(uint64_t)); for (int i = 0; i < a_len; i++) { x = (a[i] >> shift) & 0xffff; work2[x]++; work1[i] = a[i]; } work0[0] = 0; for (uint64_t u = 0; u < 0xffff; u++) work0[u + 1] = work0[u] + work2[u]; for (int i = 0; i < a_len; i++) { x = (work1[i] >> shift) & 0xffff; a[work0[x]] = work1[i]; work0[x]++; } shift += 16; } free(work0); free(work1); free(work2); } int main(void) { int n; scanf("%d", &n); int64_t a[n + 2]; for (int i = 0; i < n; ++i) scanf("%lld", a[i]); a[n] = 0; a[n + 1] = 1e9 + 7; radix_sort64(a, n + 2); int ans = 0; for (int i = 1; i <= n; ++i) if (a[i - 1] != a[i] && a[i] != a[i + 1]) ++ans; printf("%d\n", ans); return 0; }