#include <bits/stdc++.h>
using ll = long long;
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  int n, m;
  std::cin >> n >> m;
  std::vector<std::pair<ll, ll>> vec;
  for (int i = 0; i < m; ++i) {
    ll x, y;
    std::cin >> x >> y;
    vec.push_back({x, y});
  }
  std::vector<int> num(n + 1, 1);
  for (int i = 0; i < m; ++i) {
    ll x1 = vec[i].first, y1 = vec[i].second;
    for (int j = i + 1; j < m; ++j) {
      ll x2 = vec[j].first, y2 = vec[j].second;
      if (y1 == y2) {
        continue;
      }
      if (((x2 - x1) * y1) % (y2 - y1) != 0) {
        continue;
      }
      ll temp = (((x2 - x1) * y1) / (y2 - y1));
      ll intercept = -temp + x1;
      if (intercept >= 1 && intercept <= n) {
        int temp = 2;
        for (int k = j + 1; k < m; ++k) {
          ll x3 = vec[k].first, y3 = vec[k].second;
          if (((y3 - y1) * (x2 - x1)) == ((y2 - y1) * (x3 - x1))) {
            ++temp;
          }
        }
        num[intercept] = std::max(num[intercept], temp);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += num[i];
  }
  std::cout << ans << "\n";
}
