#include <stdio.h>
#import <Foundation/Foundation.h>
 
int main() {
 
  int N;
  scanf("%d", &N);
  
  NSInteger i;
  NSMutableArray *strings = [[NSMutableArray alloc] init];
  NSMutableDictionary *table = [[NSMutableDictionary alloc] init];

  NSInteger result = 0;
  for(i=0;i<N;i++) {
    char *str;
    scanf("%s", str);
    NSInteger j;
    NSInteger sum=0;
    for(j=0;j<10;j++) {
      sum += str[j] - '0';
    }
    NSNumber *sumNumber = [NSNumber numberWithInt: sum];
    if ([table objectForKey: sumNumber] != nil) {
      NSNumber *count = [NSNumber numberWithInt: [[table objectForKey: sumNumber] integerValue] + 1];
      [table setObject: count forKey: sumNumber];
    } else {
      [table setObject: [NSNumber numberWithInt:0] forKey: sumNumber];
    }
  }
 
  for(NSNumber *count in [table allValues]) {
     if ([count integerValue] > 0) {
   	     result += float((1 + [count integerValue]) / 2) * [count integerValue];
     }
  }
  printf("%d", result);
  return 0;
}