#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  std::vector<int> v;
  for (int i = 0; i < n; i++) {
    int inp;
    cin >> inp;
    if (inp != 0) {
      v.push_back(inp);
    }
  }
  sort(v.begin(), v.end());
  int count = 0;
  int prev = 0;
  for (int i = 0; i < v.size(); i++) {
    if (prev != v[i]) {
      count++;
    }
    prev = v[i];
  }
  cout << count << endl;
  return 0;
}
