```python
def count_Substrings(s, n):
    """
    Counts the number of substrings where the sum of digits equals the length.
    
    The condition `sum(digits) == length` for a substring `s[i..j]` can be rewritten as:
    sum(s_k for k in i..j) == j - i + 1
    sum(s_k for k in i..j) - (j - i + 1) == 0
    sum(s_k - 1 for k in i..j) == 0
    
    This transforms the problem into finding the number of subarrays with a sum of zero
    in a new array where each element is `d - 1` for each digit `d` in the original string.
    
    This can be solved in O(n) time using a hash map to store the frequencies of prefix sums.
    """
    
    # A map to store the frequency of each prefix sum.
    # The key is the prefix sum, and the value is its frequency.
    # We initialize with {0: 1} to account for subarrays that start from index 0.
    prefix_sum_counts = {0: 1}
    
    count = 0
    current_sum = 0
    
    for i in range(n):
        # The value in the transformed array is (digit - 1).
        val = int(s[i]) - 1
        
        # Update the current prefix sum.
        current_sum += val
        
        # If we have seen `current_sum` before, it means there is a subarray
        # between the previous occurrence and the current index whose sum is zero.
        # The number of such subarrays is equal to the number of times we've
        # seen this `current_sum` before.
        count += prefix_sum_counts.get(current_sum, 0)
        
        # Increment the frequency of the current prefix sum in the map.
        prefix_sum_counts[current_sum] = prefix_sum_counts.get(current_sum, 0) + 1
        
    return count
```