#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, ans = 0, sm = 0, flag = 0, t = 0;
  cin >> n;
  long long int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  for (int i = 0; i < n; i++) {
    long long int p = ar[i], sm = 0;
    while (p != 0) {
      sm += p % 10;
      p /= 10;
    }
    if (!(sm % 3))
      ans++;
    else if (sm % 3 == 1)
      flag++;
    else
      t++;
  }
  ans /= 2;
  ans += min(t, flag);
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  return 0;
}
