Practice · 2 of 2
Editorial Problem 2: The Gates
CHALLENGE
Difficulty: advanced+25 XP
**Bài toán.** A circuit row has n gates; gate i has state a[i] (a non-negative integer). A *stable segment* is a contiguous segment whose XOR of states is zero. Count stable segments. **Constraints:** 1 ≤ n ≤ 200000; 0 ≤ a[i] < 2^20. **Input:** line 1: n; line 2: n values. **Output:** one integer — the count (fits in 64 bits).
Press Submit to check your solution.
Back to lesson: Practice: Editorial Problems and Variations