#include <bits/stdc++.h>
using namespace std;
map<int, int> ans;
int main() {
  long long n, a, dem = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    ans[a % 3]++;
  }
  cout << ans[0] / 2 + min(ans[1], ans[2]);
}
