Recently, chef Ciel often hears about lucky numbers.

Everybody knows that lucky numbers are positive integers
whose decimal representation contains only the lucky digits 4 and 7.
For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Ciel decides to make Ciel numbers.
As you know, Ciel likes the digit 8 very much.
And then, Ciel likes the digits 5 and 3.
So Ciel defines Ciel numbers as the positive integers k such that d(k, 8) ≥ d(k, 5) ≥ d(k, 3) and d(k, i) = 0 for all i = 0, 1, 2, 4, 6, 7, 9,
where d(k, i) denotes the number of the digit i in the decimal representation of the integer k.
For example, the first few Ciel numbers are 8, 58, 85, 88, 358, 385, 538, 583, 588, 835, 853, 858, 885, 888, ....

Ciel's restaurant has N menus.
And Ciel want to know how many menus have Ciel numbers as their price.
Your task is to find it.

-----Input-----

The first line contains an integer N.
Then N lines follow.
Each line has the name Si of the menu and its price Pi separated by a single space.

-----Output-----

Print the number of menus whose prices are one of Ciel numbers.

-----Constraints-----

1 ≤ N ≤ 1000

1 ≤ |Si| ≤ 100, where |Si| denotes the length of Si

Each letter of Si is either an alphabetical letter or a digit or a single quotation mark or a space.

1 ≤ Pi < 1000000 (106)
Pi contains no leading zeros.

-----Sample Input-----
6
milk 58
Ciel's Drink 80
The curry 2nd edition 888888
rice omelet 85855
unagi 1
The first    and last letters can be a space    358

-----Sample Output-----
3

-----Output details-----

58 and 888888 and 358 are Ciel numbers.
80 and 85855 and 1 are not Ciel numbers.

-----Notes-----

Different operating systems have different ways of representing a newline; do not assume one particular way will be used.

```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 = "price=[]\nfor _ in range(int(input())):\n s=input().split()\n price.append(s[len(s)-1])\n   \ncount=0\nfor i in price:\n e=i.count('8')\n f=i.count('5')\n t=i.count('3')\n d=i.count('.')\n if e+f+t+d==len(i):\n  if e>=f and f>=t:\n   count+=1\nprint(count)"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13273