#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp;
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  map<int, int> steps;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    if (tmp != 0) {
      steps.insert(pair<int, int>(tmp, i));
    }
  }
  cout << steps.size() << '\n';
  return 0;
}
