#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int f[3] = {0};
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    int x = arr[i];
    int sum = 0;
    while (x > 0) {
      sum += (x % 10);
      x = x / 10;
    }
    f[sum % 3]++;
  }
  int cnt = 0;
  cnt += (f[0] / 2);
  cnt += min(f[1], f[2]);
  cout << cnt;
}
