#include int main () { int n = 0; char s[200001] = ""; int res = 0; int ans = 0; int cnt[10] = {}; int flg[40] = {}; res = scanf("%d", &n); res = scanf("%s", s); for (int i = 0; i < n; i++) { cnt[(int)(s[i]-'0')]++; } if (n < 2) { printf("1\n"); return 0; } if (n < 3 && s[0] == s[1]) { printf("1\n"); return 0; } if (n < 3) { printf("2\n"); return 0; } for (int i = 0; i < 1000; i++) { int tmpcnt[10] = {}; int tmp = i; int is_ok = 1; tmpcnt[i%10]++; tmpcnt[(i/10)%10]++; tmpcnt[i/100]++; for (int j = 0; j < 10; j++) { if (tmpcnt[j] > cnt[j]) { is_ok = 0; } } if (is_ok > 0) { flg[i%40] = 1; } } for (int i = 0; i < 40; i++) { ans += flg[i]; } printf("%d\n", ans); return 0; }