#include <bits/stdc++.h>
long long cmpfunc(const void* a, const void* b) {
  return (*(long long*)a - *(long long*)b);
}
int main(void) {
  long long int test, i, j, n, count, flag = 0, o1 = 0, o2 = 0, b1, x, m, l,
                                      max, sum2, min, f, r, o, sum1, sum = 0, y,
                                      count1 = 0, a[1000000];
  scanf("%lld", &n);
  count = 0;
  f = 0;
  for (i = 0; i < n; i++) {
    scanf("%lld", &x);
    if (a[x] == 0 && x != 0) {
      count++;
      a[x]++;
    }
  }
  printf("%lld\n", count);
  return 0;
}
