#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long n;
    cin >> n;
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) cin >> v[i];
    set<int> s((v).begin(), (v).end());
    long long count = 0;
    for (auto i : s) {
      if (i != 0) count++;
    }
    cout << count;
  }
  return 0;
}
