#include <bits/stdc++.h>
using namespace std;
void ONLINE__JUDGE();
const int mod = 998244353;
const int MAX = 1009;
long long x, y, z, o, t;
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  ONLINE__JUDGE();
  cin >> x;
  for (int i = 0; i < x; i++) {
    cin >> y;
    if (y % 3 == 0)
      z++;
    else if (y % 3 == 1)
      o++;
    else if (y % 3 == 2)
      t++;
  }
  cout << min(o, t) + z / 2;
  return 0;
}
void ONLINE__JUDGE() {}
