数珠子颜色
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for(int i = 0;i < n;i++){
a[i] = sc.nextInt();
}
long sum = 0;
for(int i = 0;i < n;i++){
HashSet<Integer> map = new HashSet<Integer>();
sum++;
int now = 1;
map.add(a[i]);
for(int j = i + 1;j < n;j++){
if(!map.contains(a[j])){
now++;
map.add(a[j]);
}
sum+=now;
}
}
System.out.println(sum);
}
}