Let $ S $ be the set of all seven-digit numbers that can be formed using the digits 0, 1 and 2. For example, 2210222 is in $ S $, but 0210222 is NOT in $ S $.
Then the number of elements $ x $ in $ S $ such that at least one of the digits 0 and 1 appears exactly twice in $ x $, is equal to __________.


