#include <bits/stdc++.h>
using namespace std;
long long n, a[100001], dem = 0;
bool dx[100000001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] != 0) dx[a[i] + 1000001] = true;
  }
  for (int i = 1; i <= 100000001; i++)
    if (dx[i] == true) dem++;
  cout << dem;
}
