```python
def check_Equality(s):
    """
    Counts the number of substrings with the same first and last characters.

    This function iterates through all possible substrings of the input string,
    checks if the first and last characters of each substring are the same,
    and counts how many such substrings exist.
    """
    n = len(s)
    count = 0
    for i in range(n):
        for j in range(i, n):
            # Substring is s[i:j+1]
            # We only need to compare the first character s[i] and the last s[j]
            if s[i] == s[j]:
                count += 1
    return count
```