```python
import collections

def check_Equality(s):
    """
    Counts the number of substrings with the same first and last characters.
    """
    char_counts = collections.Counter(s)
    
    total_count = 0
    for k in char_counts.values():
        # For a character that appears k times, the number of substrings
        # starting and ending with this character is the number of ways
        # to choose 2 of its occurrences (with replacement), which is k * (k + 1) / 2.
        total_count += k * (k + 1) // 2
        
    return total_count
```