#include <bits/stdc++.h>
using namespace std;
int res[3];
int min(int a, int b) { return a < b ? a : b; }
int main() {
  int n, m;
  cin >> n;
  while (n--) {
    cin >> m;
    res[m % 3]++;
  }
  cout << res[0] / 2 + min(res[1], res[2]);
}
