#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mod1 = 998244353;
const long long inf = 9223372036ll;
long long dig_sum(long long x) {
  long long s = 0;
  while (x) {
    s += (x % 10);
    x /= 10;
  }
  return s % 3;
}
void solve() {
  long long n;
  cin >> n;
  long long mp[3] = {0};
  for (long long i = (0); i < (n); i++) {
    long long x;
    cin >> x;
    mp[dig_sum(x)]++;
  }
  long long ans = 0;
  ans += mp[0] / 2 + min(mp[1], mp[2]);
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
