#include <bits/stdc++.h>
using namespace std;
template <typename T>
void __read(T &a) {
  cin >> a;
}
template <typename T, typename... Args>
void __read(T &a, Args &...args) {
  cin >> a;
  __read(args...);
}
constexpr long long M7 = 1000000007ll;
constexpr long long M9 = 1000000009ll;
constexpr long long MFFT = 998244353ll;
template <class T>
void outv(const T &a) {
  for (auto &x : a) cout << x << ' ';
}
static mt19937 rnd(static_cast<unsigned>(
    chrono::steady_clock::now().time_since_epoch().count()));
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr));
int32_t main() {
  long long n;
  __read(n);
  vector<long long> cnt(3);
  for (long long i = 0; i < n; ++i) {
    long long q;
    __read(q);
    long long z = 0;
    while (q > 0) {
      z += q % 10;
      q /= 10;
    }
    cnt[z % 3]++;
  }
  cout << cnt[0] / 2 + min(cnt[1], cnt[2]);
  return 0;
}
