#include<bits/stdc++.h>
using namespace std;
int sum = 0;
int main() {
int n, a[50];
while (cin>>n) {
for (int i = 0; i < n; i++) {
cin>>a[i];
}
sum = 0;
int temp ;
for (int len = 1; len <= n; len++) {
for (int i = 0;i + len <= n; i++) {
temp = 0;
for (int j = 0; j < len; j++) {
temp += a[j + i];
}
if (temp % 11 == 0) {
++sum;
}
}
}
cout<<sum<<endl;
}
}