#include <iostream>
#include <set>
using namespace std;
set<long long> st;
long long nr, b[20], j, k, t, i;
char a[20];

int main()
{
	for(i=1; i<=9; i++)
	{
		cin>>a[i];
		b[i]=a[i]-48;
	}
	for(j=2; j<=9; j++)
	{
		for(k=0; k<=9; k++)
		{
			nr=0;
			for(t=1; t<=9; t++)
			{
				nr=nr*10+b[t];
				if(t==j)
					nr=nr*10+k;
			}
			st.insert(nr);
		}
	}
	cout<<st.size();
}