#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans1 = 0, ans2 = 0;
  cin >> n;
  long int a[10009] = {0}, i, j, k, cnt[4] = {0};
  for (i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
    int temp;
    temp = a[i] % 3;
    cnt[temp]++;
  }
  if (cnt[1] < cnt[2])
    ans1 = cnt[1];
  else if (cnt[2] <= cnt[1])
    ans1 = cnt[2];
  ans2 = cnt[0] / 2;
  cout << ans1 + ans2 << endl;
}
