#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define offset 
const ll MOD= 1e9+7;
#define initseg ll new_nodo=(nodo*2),mid=(iz+der)/2;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 223455
ll D;
ll m;
map<ll,ll> ways;
ll vexp[tam],pot[tam];
ll f(ll pos,ll D2)
{
    if (pos==m)
    {
        return (D2==D);
    }
    ll formas=0;
    ll maxx=-9,minn=9;
    forr(delt,-9,10)
    {
        if (D2+vexp[pos]*delt<=D)
            maxx=delt;
        if (D2+vexp[pos]*delt>D)
            minn=min(minn,delt);
    }
    formas+=f(pos+1,minn*vexp[pos]+D2)*ways[minn];
    if (maxx!=minn)
    formas+=f(pos+1,maxx*vexp[pos]+D2)*ways[maxx];
    return formas;
}
ll go(ll digs)
{
    m=(digs/2);
    //cout<<digs<<' '<<m<<": ";
    forr(i,0,m)
    {
        vexp[i]=(pot[digs-1-i]-pot[i]);
        //cout<<vexp[i]<<" ";
    }
    //cout<<endl;
    ll total=0;
    forr(i,-9,10)
    {
        total+=f(1,vexp[0]*i)*(ways[i]-1);
        //cout<<total<<" "<<i<<' '<<ways[i]-1<<endl;
    }
    if (digs%2==1)
        total= total*10;
        return total;
}
int  main()
{
    forr(i,0,10)
    {
        forr(j,0,10)
        {
            ways[i-j]++;
        }
    }
    
    pot[0]=1;
    forr(i,1,19)
        pot[i]=pot[i-1]*10;
    cin>>D;
    ll formas=0;
    forr(digs,2,19)
    {
        formas+=go(digs);
        //cout<<formas<<'\n';
    }
    cout<<formas<<endl;
}
// PLUS ULTRA!ac
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,sum=0;
        cin>>n;
        ll A[n];
        map<ll,ll>B;
        for(ll i=0;i<n;i++)
        {
            cin>>A[i];
            B[A[i]]++;
            
        }
      sort(A,A+n);
        for(ll i=0;i<n;i++)
        {
            sum=sum+(B[A[i]]%2);
          i=i+B[A[i]]-1;
        }
        cout<<sum;
    } 
    return 0;
}
