#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long inp;
  vector<long long> v, temp;
  for (int i = 0; i < n; i++) {
    long long sum = 0;
    cin >> inp;
    string s = to_string(inp);
    for (int j = 0; j < s.length(); j++) {
      sum += s[j] - '0';
    }
    v.push_back(sum);
    temp.push_back(0);
  }
  int counter = 0;
  for (int i = 0; i < v.size() - 1; i++) {
    if (temp[i] == 0) {
      for (int j = i + 1; j < v.size(); j++) {
        if (temp[j] == 0) {
          if ((v[i] + v[j]) % 3 == 0) {
            temp[i] = 1;
            temp[j] = 1;
            counter++;
            break;
          }
        }
      }
    }
  }
  cout << counter;
}
