#include <bits/stdc++.h>
#pragma gcc_optimize(O3)
#pragma gcc_optimize(unroll_loops)
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, temp;
  cin >> n;
  set<int> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> temp;
    a[i] = temp;
    if (temp != 0) s.insert(temp);
  }
  cout << s.size();
  return 0;
}
