# B--Faultfinding

B--Faultfinding

Do you remember the game in which we find difference among several similar pictures? Now we change it into digital version. There are N digits, same or different. Please find how many different digits there are among them and output the number.

Each group of the first line is N (1<=N<=10000). The second line consists N integers.

The number of different digits.

``````2
1 1
3
1 2 3
``````

``````1
3
``````

``````#include <stdio.h>
int main()
{
int s,a[10000],n=1,i,j;
while (~scanf("%d",&s)&&s)
{

for (i=0; i<s; i++)scanf("%d",a+i);
for (i=1; i<s; i++)
for (j=i-1; j>=0; j--)
{
if (a[j]==a[i])break;
if (j==0)n++;
}
printf("%d\n",n);
}
return 0;
}``````

``````#include <iostream>

using namespace std;

int main()
{
int N;
int a[10000],b[10000];
int num=1,different;
while(cin>>N)
{
for(int i=0;i<N;i++)
{
cin>>a[i];
}
b[0]=a[0];
num=1;
for(int i=1;i<N;i++)
{
different=0;
for(int j=0;j<num;j++)
{
if(a[i]!=b[j])
++different;
}
if(different==num)
{
b[num]=a[i];
num++;
}
}
cout<<num<<endl;
}
return 0;
}

``````