#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e15 + 7;
const long long N = 1e6;
long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long fpow(long long n, long long k, long long p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
long long inv(long long a, long long p = MOD) { return fpow(a, p - 2, p); }
long long mult(long long a, long long b, long long p = MOD) {
  return (long long)((a % p) * (b % p)) % p;
}
vector<long long> prime(N + 1);
void sieve() {
  prime[0] = prime[1] = 1;
  for (long long i = 2; i <= N; i++) {
    if (!prime[i]) {
      prime[i] = i;
      for (long long j = i * i; j <= N; j += i)
        if (!prime[j]) prime[j] = i;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  clock_t tStart = clock();
  set<int> a;
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x != 0) a.insert(x);
  }
  cout << a.size() << "\n";
  cerr << "Time Elapsed : " << fixed << setprecision(10)
       << (double)(clock() - tStart) / CLOCKS_PER_SEC << "\n";
  return 0;
}
