// p03_04.cpp: How many distinct integers are read? 
//   (Duplicates are not counted.)
#include <iostream>
using namespace std;

int main()
{  const int maxN = 20;
   // At most 20 distinct integers, with unlimited numbers of
   // duplicates.
   cout << "Enter integers, followed by a nonnumeric 
           "character:\n";
   int n=0, i, a[maxN], x;
   while (cin >> x)
   {  for (i=0; i<n; ++i) 
         if (x == a[i]) break;
      if (i == n)    
      {  if (n == maxN) 
         {  cout << "More than " << maxN 
                 << " distinct integers in input.\n";
            return 0;
         }
         a[n++] = x;
      }
   }
   cout << "Number of distinct integers: " << n 
        << endl;
   return 0;
}

