#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long n) {
  long long ret = 1;
  x %= 1000000007;
  while (n > 0) {
    if (n & 1) ret = (ret * x) % 1000000007;
    x = (x * x) % 1000000007;
    n /= 2;
  }
  return ret;
}
long long n, m, ar[300009];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long test = 1, t, flag, i, j, k, l, a, b, c, d, ans;
  while (test--) {
    cin >> n;
    map<long long, long long> mv;
    ans = 0;
    for (i = 1; i <= n; i++) {
      cin >> ar[i];
      if (ar[i] != 0 && mv.find(ar[i]) == mv.end()) {
        mv[ar[i]]++, ans++;
      }
    }
    cout << ans;
  }
  return 0;
}
