To make Yalalovichik even more satisfied and happy, Jafar decided to invent Yalalovichik strings. A string is called a Yalalovichik string if the set of all of its distinct non-empty substrings is equal to the set of all of its distinct non-empty subsequences. 
You are given a string S$S$. You need to find the number of its distinct non-empty substrings which are Yalalovichik strings.
Note: A string A$A$ is called a subsequence of a string B$B$ if A$A$ can be formed by erasing some characters (possibly none) from B$B$. A string A$A$ is called a substring of a string B$B$ if it can be formed by erasing some characters (possibly none) from the beginning of B$B$ and some (possibly none) from the end of B$B$. Two substrings or subsequences are considered different if they are different strings.

-----Input-----
- The first line of the input contains a single integer T$T$ denoting the number of test cases. The description of T$T$ test cases follows.
- The first line of each test case contains a single integer N=|S|$N = |S|$.
- The second line contains the string S$S$.

-----Output-----
For each test case, print a single line containing one integer — the number of distinct Yalalovichik substrings of S$S$.

-----Constraints-----
- 1≤T≤100$1 \le T \le 100$
- 1≤N≤106$1 \le N \le 10^6$
- the sum of N$N$ over all test cases does not exceed 2⋅106$2 \cdot 10^6$
- S$S$ contains only lowercase English letters

-----Example Input-----
1
3
xxx

-----Example Output-----
3

-----Explanation-----
Example case 1: The distinct Yalalovichik substrings are "x", "xx" and "xxx".

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 't = int(input())\nwhile t>0:\n    t-=1\n    n = int(input())\n    s = input().strip()\n    previ = s[0]\n    num = 0\n    _s = []\n    dic = {}\n    for i in s:\n     if previ == i:\n      num+=1\n      continue\n     _s.append((previ, num))\n     if previ not in dic or dic[previ]<num:\n      dic[previ] = num\n     #l.append(previ)\n     previ = i\n     num  = 1\n    _s.append((previ, num))\n    if previ not in dic or dic[previ]<num:\n      dic[previ] = num\n\n    ##print(_s)\n    sum1 = sum(dic.values())\n    del dic, s'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13193