#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<1;i++) {
    char *str;
    scanf("%s", str);
    NSInteger j;
    NSInteger sum=0;
    for(j=0;j<10;j++) {
      sum += str[j] - '0';
    }
    if (table[@(sum)]) {
      table[@(sum)] = @([table[@(sum)] integerValue] + 1);
    } else {
      table[@(sum)] = @(1);
    }
  }
 
  for(NSNumber *count in [table allValues]) {
    result += count.integerValue;
  }
  printf("%d", result);
  return 0;
}