#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *left,*right;
}s1;
int count=0;
s1* create(int num){
    s1* new=(s1*)malloc(sizeof(s1));
    new->data=num;
    new->right=new->left=NULL;
    return new;
}

s1* insert(s1 * root,int num){
    if(root==NULL){
        return create(num);
    }else if(num<root->data){
        root->left=insert(root->left,num);
    }else{
        root->right= insert(root->right,num);
    }
    return root;
    
}

int preorder(s1* root){
    if(root==NULL){
        return root;
    }
    else
        return 1+preorder(root->left)+preorder(root->right);
    
}

int main(){
    int size,val,num;
    s1* root;
    scanf("%d",&size);
    if(size<0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<size;i++){
        if(!scanf("%d",&num)||num<0||num=='\n'&&num==' '){
            printf("Invalid input");
            return 0;
        }
        root=insert(root,num);

    }
    preorder(root);
    printf("%d",preorder(root));
    
    return 0;
}