#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> v;
  while (n--) {
    int inp;
    std::cin >> inp;
    v.push_back(inp);
  }
  std::sort(v.begin(), v.end());
  int cnt = 0;
  int prev = v[0];
  if (prev != 0) cnt++;
  for (auto x : v) {
    if (x != 0 && x != prev) cnt++;
    prev = x;
  }
  std::cout << cnt << std::endl;
}
