#define _CRT_SECURE_NO_WARNINGS //#define _GLIBCXX_DEBUG #include using namespace std; typedef long long ll; //#define int ll //#define endl "\n" typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i ostream & operator<<(ostream & os, vector const &); template typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple const &){} template typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple const & t){ os << (n==0?"":" ") << get(t); _ot(os, t); } template ostream & operator<<(ostream & os, tuple const & t){ _ot<0>(os, t); return os; } template ostream & operator<<(ostream & os, pair const & p){ return os << "(" << p.first << ", " << p.second << ") "; } template ostream & operator<<(ostream & os, vector const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; } template inline bool chmax(T & x, T const & y){ return x inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; } #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "< a {2015,1,1, 2015,1,2, 2015,1,3, 2015,1,4, 2015,1,5, 2015,1,6, 2015,1,7, 2015,1,8, 2015,1,9, 2015,1,10, 2015,1,11, 2015,1,12, 2015,1,13, 2015,1,14, 2015,1,15, 2015,1,16, 2015,1,17, 2015,1,18, 2015,1,19, 2015,1,20, 2015,1,21, 2015,1,22, 2015,1,23, 2015,1,24, 2015,1,25, 2015,1,26, 2015,1,27, 2015,1,28, 2015,1,29, 2015,1,30, 2015,1,31, 2015,2,1, 2015,2,2, 2015,2,3, 2015,2,4, 2015,2,5, 2015,2,6, 2015,2,7, 2015,2,8, 2015,2,9, 2015,2,10, 2015,2,11, 2015,2,12, 2015,2,13, 2015,2,14, 2015,2,15, 2015,2,16, 2015,2,17, 2015,2,18, 2015,2,19, 2015,2,20, 2015,2,21, 2015,2,22, 2015,2,23, 2015,2,24, 2015,2,25, 2015,2,26, 2015,2,27, 2015,2,28, 2015,3,1, 2015,3,2, 2015,3,3, 2015,3,4, 2015,3,5, 2015,3,6, 2015,3,7, 2015,3,8, 2015,3,9, 2015,3,10, 2015,3,11, 2015,3,12, 2015,3,13, 2015,3,14, 2015,3,15, 2015,3,16, 2015,3,17, 2015,3,18, 2015,3,19, 2015,3,20, 2015,3,21, 2015,3,22, 2015,3,23, 2015,3,24, 2015,3,25, 2015,3,26, 2015,3,27, 2015,3,28, 2015,3,29, 2015,3,30, 2015,3,31, 2015,4,1, 2015,4,2, 2015,4,3, 2015,4,4, 2015,4,5, 2015,4,6, 2015,4,7, 2015,4,8, 2015,4,9, 2015,4,10, 2015,4,11, 2015,4,12, 2015,4,13, 2015,4,14, 2015,4,15, 2015,4,16, 2015,4,17, 2015,4,18, 2015,4,19, 2015,4,20, 2015,4,21, 2015,4,22, 2015,4,23, 2015,4,24, 2015,4,25, 2015,4,26, 2015,4,27, 2015,4,28, 2015,4,29, 2015,4,30, 2015,5,1, 2015,5,2, 2015,5,3, 2015,5,4, 2015,5,5, 2015,5,6, 2015,5,7, 2015,5,8, 2015,5,9, 2015,5,10, 2015,5,11, 2015,5,12, 2015,5,13, 2015,5,14, 2015,5,15, 2015,5,16, 2015,5,17, 2015,5,18, 2015,5,19, 2015,5,20, 2015,5,21, 2015,5,22, 2015,5,23, 2015,5,24, 2015,5,25, 2015,5,26, 2015,5,27, 2015,5,28, 2015,5,29, 2015,5,30, 2015,5,31, 2015,6,1, 2015,6,2, 2015,6,3, 2015,6,4, 2015,6,5, 2015,6,6, 2015,6,7, 2015,6,8, 2015,6,9, 2015,6,10, 2015,6,11, 2015,6,12, 2015,6,13, 2015,6,14, 2015,6,15, 2015,6,16, 2015,6,17, 2015,6,18, 2015,6,19, 2015,6,20, 2015,6,21, 2015,6,22, 2015,6,23, 2015,6,24, 2015,6,25, 2015,6,26, 2015,6,27, 2015,6,28, 2015,6,29, 2015,6,30, 2015,7,1, 2015,7,2, 2015,7,3, 2015,7,4, 2015,7,5, 2015,7,6, 2015,7,7, 2015,7,8, 2015,7,9, 2015,7,10, 2015,7,11, 2015,7,12, 2015,7,13, 2015,7,14, 2015,7,15, 2015,7,16, 2015,7,17, 2015,7,18, 2015,7,19, 2015,7,20, 2015,7,21, 2015,7,22, 2015,7,23, 2015,7,24, 2015,7,25, 2015,7,26, 2015,7,27, 2015,7,28, 2015,7,29, 2015,7,30, 2015,7,31, 2015,8,1, 2015,8,2, 2015,8,3, 2015,8,4, 2015,8,5, 2015,8,6, 2015,8,7, 2015,8,8, 2015,8,9, 2015,8,10, 2015,8,11, 2015,8,12, 2015,8,13, 2015,8,14, 2015,8,15, 2015,8,16, 2015,8,17, 2015,8,18, 2015,8,19, 2015,8,20, 2015,8,21, 2015,8,22, 2015,8,23, 2015,8,24, 2015,8,25, 2015,8,26, 2015,8,27, 2015,8,28, 2015,8,29, 2015,8,30, 2015,8,31, 2015,9,1, 2015,9,2, 2015,9,3, 2015,9,4, 2015,9,5, 2015,9,6, 2015,9,7, 2015,9,8, 2015,9,9, 2015,9,10, 2015,9,11, 2015,9,12, 2015,9,13, 2015,9,14, 2015,9,15, 2015,9,16, 2015,9,17, 2015,9,18, 2015,9,19, 2015,9,20, 2015,9,21, 2015,9,22, 2015,9,23, 2015,9,24, 2015,9,25, 2015,9,26, 2015,9,27, 2015,9,28, 2015,9,29, 2015,9,30, 2015,10,1, 2015,10,2, 2015,10,3, 2015,10,4, 2015,10,5, 2015,10,6, 2015,10,7, 2015,10,8, 2015,10,9, 2015,10,10, 2015,10,11, 2015,10,12, 2015,10,13, 2015,10,14, 2015,10,15, 2015,10,16, 2015,10,17, 2015,10,18, 2015,10,19, 2015,10,20, 2015,10,21, 2015,10,22, 2015,10,23, 2015,10,24, 2015,10,25, 2015,10,26, 2015,10,27, 2015,10,28, 2015,10,29, 2015,10,30, 2015,10,31, 2015,11,1, 2015,11,2, 2015,11,3, 2015,11,4, 2015,11,5, 2015,11,6, 2015,11,7, 2015,11,8, 2015,11,9, 2015,11,10, 2015,11,11, 2015,11,12, 2015,11,13, 2015,11,14, 2015,11,15, 2015,11,16, 2015,11,17, 2015,11,18, 2015,11,19, 2015,11,20, 2015,11,21, 2015,11,22, 2015,11,23, 2015,11,24, 2015,11,25, 2015,11,26, 2015,11,27, 2015,11,28, 2015,11,29, 2015,11,30, 2015,12,1, 2015,12,2, 2015,12,3, 2015,12,4, 2015,12,5, 2015,12,6, 2015,12,7, 2015,12,8, 2015,12,9, 2015,12,10, 2015,12,11, 2015,12,12}; int f(int x){ int res = 0; while(x) res += x%10; return res; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int ans = 0; for(int i=0;i+2<(int)a.size();i+=3){ int p = a[i+1]; int q = a[i+2]; if(f(p)==f(q)) ans++; } cout << ans << endl; }