#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long int mo(const long long int input, const long long int ceil) {
  return input >= ceil ? input % ceil : input;
}
void solve(int t) {
  long long int n;
  cin >> n;
  set<long long int> arr;
  long long int gf;
  for (long long int i = 0; i < n; i++) {
    cin >> gf;
    if (gf != 0) arr.insert(gf);
  }
  long long int vf = arr.size();
  cout << vf << "\n";
}
int main() {
  auto start = chrono::high_resolution_clock::now();
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  for (int i = 0; i < t; i++) solve(t);
  auto end = chrono::high_resolution_clock::now();
  double time_taken =
      chrono::duration_cast<chrono::nanoseconds>(end - start).count();
  time_taken *= 1e-9;
  cerr << "Time taken by program is : " << fixed << time_taken
       << setprecision(9);
  cerr << " sec" << endl;
  return 0;
}
