#include <bits/stdc++.h>
using namespace std;
bool vowel(char a) {
  a = toupper(a);
  if ((a == 'A') || (a == 'E') || (a == 'I') || (a == 'O') || (a == 'U'))
    return 1;
  return 0;
}
long long int n, m, q, a, b, c, sum = 0, cnt = 0;
long long int arr[1000055];
unordered_map<long long int, bool> mp;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == 0) continue;
    if (!mp[a]) cnt++;
    mp[a] = 1;
  }
  cout << cnt << endl;
}
