# include <stdio.h>
# include <malloc.h>

int return_value(int, int);

int main(void)
{
    int N, K;
    int * list;
    int i, j;
    int count;

    scanf("%d", &N);
    list = (int *)malloc(N * sizeof(int));
    for (i=0; i<N, ++i)
        scanf("%d", list[i]);

    for (i=0; i<N, ++i)
    {
        for (j=i; j<N; ++j)
        {
            if (return_value(list[i], list[j]) <= K)
            {
                ++count;
                break;
            }
        }
        
    }
    printf("%d", count);

    return 0;
}

int return_value(int i, int j)
{
    if (i > j)
        return (i - j);
    else
        return (j - i);
}