#!/usr/bin/perl

use v5.30;
use strict;

my $valid = 0;
LINE:
while (<>) {
	chomp;
	my %seen;
	for my $w (split /\s+/) {
		my $w1 = join('', sort split //, $w);
		next LINE if $seen{$w1}++;
	}
	$valid++;
}

say $valid;
		
