#include #include #include using namespace std; using ll = long long; int main() { int n, A[100000], count = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", A + i); sort(A, A + n); for (int i = 1; i < (n - 1); i++) if (A[i - 1] != A[i] && A[i] != A[i + 1]) count++; count += A[0] != A[1]; count += A[n - 1] != A[n - 2]; printf("%d\n", count); }