#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
using namespace std;
const int maxn = 1010;
struct Node{
int x;
int l, r;
}node[maxn];
int N;
int used[maxn];
int maxDeep = -1;
void insert(int &root, int x, int addr, int deep){
if(root == -1){
root = addr;
node[root].x = x;
node[root].l = node[root].r = -1;
maxDeep = max(maxDeep, deep);
return;
}
if(x <= node[root].x) insert(node[root].l, x, addr, deep+1);
else if(x > node[root].x) insert(node[root].r, x, addr, deep+1);
}
int n1 = 0, n2 = 0;
void dfs(int root, int deep){
used[root] = 1;
if(deep == maxDeep) n1++;
else if(deep == maxDeep-1) n2++;
if(node[root].l != -1 && !used[node[root].l])
dfs(node[root].l, deep+1);
if(node[root].r != -1 && !used[node[root].r])
dfs(node[root].r, deep+1);
}
int main() {
//freopen("1.txt", "r", stdin);
scanf("%d", &N);
int x, first = -1;
for(int i = 0; i < N; i++){
scanf("%d", &x);
insert(first, x, i, 1);
}
memset(used, 0, sizeof(used));
dfs(first, 1);
printf("%d + %d = %d\n", n1, n2, n1+n2);
return 0;
}