#include<stdio.h>
#include<stdlib.h>

int count=0,count2=0;
typedef struct node{
    int data;
    struct node *right,*left;
}Node;

 Node *root=NULL;

Node *create(int val){
    
    Node *n=(Node*)malloc(sizeof(Node));
    n->data=val;
    n->left=NULL;
    n->right=NULL;
    return n;
}

Node *insert(Node *root ,int num){
    if(root==NULL){
        return create(num);
    }
    else if(root->data > num){
        root->left=insert(root->left,num);
    }
    else if(root->data < num){
        root->right=insert(root->right,num);
    }
    return root;
}

void display(root){
    Node *temp=root,*j=root;
    while(temp!=NULL){
         count++;
        temp=temp->next;
    }
     while(j!=NULL){
         count2++;
        j=j->next;
    }
    
    int finalcount=count+count2;
    printf("%d",finalcount);
}




int main(){
    int n,val,num;
    scanf("%d",&n);
    for(int i=0 ; i<n;i++){
        scanf("%d",&val);
        root=insert(root,val);
    }
    display(root);
    return 0;
}