------
## 最终结论
```python
def least_intervals(tasks, n):
    from collections import Counter

    # Step 1: Calculate frequency of each task
    frequency = Counter(tasks)

    # Step 2: Determine max frequency and count of tasks with that frequency
    max_freq = max(frequency.values())
    max_count = sum(1 for count in frequency.values() if count == max_freq)

    # Step 3: Calculate minimum intervals needed
    min_intervals = (max_freq - 1) * (n + 1) + max_count

    # Step 4: Return the maximum of calculated intervals and total tasks
    return max(min_intervals, len(tasks))

# Example usage:
tasks = ["A", "A", "A", "B", "B", "B"]
n = 2
output = least_intervals(tasks, n)
print(output)  # Output: 8
```