#include <bits/stdc++.h>
using namespace std;
int n, res = 0;
int a[500500];
bool used[500500];
const int sum = 100100;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (!x) {
      continue;
    }
    x += sum;
    if (!used[x]) {
      res++;
      used[x] = 1;
    }
  }
  cout << res;
  return 0;
}
