#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
 
int main()
{
	long long int r = 0;
	long long int n;
	std::cin >> n;
	std::vector<std::string> s;
	s.resize(n);
	for (int i = 0; i < n; i++)
	{
		std::cin >> s[i];
		std::sort(s[i].begin(), s[i].end());
	}
 
	for (auto i = s.begin(), ei = s.end() - 1; i != ei; i++)
	{
		for (auto j = i + 1, ej = s.end(); j != ej; j++)
		{
			if ((*i).compare(*j) == 0)
			{
			    r += 1;
			}
		}
	}
 
	std::cout << r << '\n';
 
	return 0;
}