#include <bits/stdc++.h>
using namespace std;
long long i, n, d, s[1111111], t, l, r, m, a[1111111], ans, k;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (s[a[i]] == 0 && a[i] != 0) r++, s[a[i]]++;
  }
  cout << r;
}
