#include <bits/stdc++.h>
using namespace std;
int arr[200100];
int main(void) {
  int n, sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (!x) continue;
    x += 100000;
    if (!arr[x]) {
      arr[x]++;
      sum++;
    }
  }
  cout << sum;
}
