#include <iostream>
#include <vector>
bool IsGroupWord(std::string str)
{
int combo = 0;
int prevANCII = str[0], ANCII = 0;
bool IsAnotherNum = false;
for (size_t i = 0; i < str.size(); i++)
{
IsAnotherNum = false;
for (size_t j = i; j < str.size(); j++)
{
if (str[i] == str[j] && IsAnotherNum)
return false;
if (str[i] != str[j])
{
IsAnotherNum = true;
}
}
}
return true;
}
int main(void)
{
std::cin.tie(NULL);
std::cout.tie(NULL);
std::ios::sync_with_stdio(false);
int N = 0;
std::cin >> N;
std::vector<std::string> index(N);
for (size_t i = 0; i < index.size(); i++)
{
std::cin >> index[i];
}
int cnt = 0;
for (size_t i = 0; i < index.size(); i++)
{
if (IsGroupWord(index[i]))
cnt++;
}
std::cout << cnt << "\n";
return 0;
}
1316번: 그룹 단어 체커 (acmicpc.net)