------
## 最终结论
```python
def longest_subseq_with_diff_one(arr, n):
    dp = [1] * n  # Initialize dp array with 1s
    for i in range(1, n):
        for j in range(i):
            if abs(arr[i] - arr[j]) == 1:  # Check if the difference is 1
                dp[i] = max(dp[i], dp[j] + 1)  # Update the dp value
    return max(dp)  # Return the maximum value in dp array

# Test cases
assert longest_subseq_with_diff_one([1, 2, 3, 4, 5, 3, 2], 7) == 6
assert longest_subseq_with_diff_one([10, 9, 4, 5, 4, 8, 6], 7) == 3
assert longest_subseq_with_diff_one([1, 2, 3, 2, 3, 7, 2, 1], 8) == 7
```