#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  map<long long, long long> mp;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] != 0) {
      mp[a[i]]++;
    }
  }
  cout << mp.size() << endl;
  return 0;
}
