#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
int gcd(int a, int b) {
  if (b > a) swap(a, b);
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long next(long long a, long long b, long long c, long long x0) {
  return ((a * x0 * x0 + b * x0 + c) / 100) % 1000000;
}
vector<int> pf(string s) {
  int n = s.size();
  vector<int> pref(n);
  pref[0] = 0;
  for (int i = 1, j = 0; i < n; i++) {
    while (j > 0 && s[i] != s[j]) j = pref[j - 1];
    if (s[i] == s[j]) j++;
    pref[i] = j;
  }
  return pref;
}
int digitSum(string s) {
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    ans += (s[i] - '0');
  }
  return ans;
}
int digitSum(int a) {
  int ans = 0;
  while (a) {
    ans += a % 10;
    a /= 10;
  }
  return ans;
}
int main() {
  int n, a, count = 0;
  cin >> n;
  vector<int> sums(n), u(3, 0);
  for (int i = 0; i < n; i++) {
    cin >> a;
    sums[i] = digitSum(a) % 3;
    u[sums[i]]++;
  }
  cout << u[0] / 2 + min(u[1], u[2]) << endl;
  return 0;
}
