#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
int cnt = 1, tr[200135 * 40][2], sn[200135 * 40], fa[200135 * 40];
void ins(int len, unsigned int x, int fg) {
  int rt = 1;
  for (int(i) = 1; (i) <= (int)(len); (i)++) {
    int j = 32 - i;
    int num = (x >> j) & 1;
    if (tr[rt][num] == 0) {
      tr[rt][num] = ++cnt;
      fa[cnt] = rt;
    }
    rt = tr[rt][num];
  }
  if (sn[rt] == -fg) et();
  sn[rt] = fg;
}
bool num(char x) { return '0' <= x && x <= '9'; }
void dec(string& s) {
  int N = s.size();
  int fg = s[0] == '-' ? -1 : 1;
  int st = 1;
  unsigned int t = 0;
  for (int(i) = 0; (i) < (int)(4); (i)++) {
    unsigned int x = 0;
    while (num(s[st])) {
      x = x * 10 + (s[st] - '0');
      st++;
    }
    t += x * (1 << (24 - i * 8));
    st++;
  }
  int X = 32;
  if (st < N) {
    int x = 0;
    while (st < N && num(s[st])) {
      x = x * 10 + (s[st] - '0');
      st++;
    }
    X = x;
  }
  ins(X, t, fg);
}
vector<pair<unsigned int, int>> ans;
void dfs(int x, int len, unsigned int val) {
  if (sn[x] == -1) {
    ans.push_back({val, len});
    return;
  }
  if (tr[x][0]) dfs(tr[x][0], len + 1, val);
  if (tr[x][1]) dfs(tr[x][1], len + 1, val + (1 << (31 - len)));
}
void fmain(int tid) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    string s;
    cin >> s;
    dec(s);
  }
  for (int i = 0; i <= cnt; i++)
    if (sn[i] == -1) {
      int x = i;
      while (fa[x]) {
        x = fa[x];
        if (sn[x] == 1) {
          et();
        }
      }
    }
  for (int i = 0; i <= cnt; i++)
    if (sn[i] == 1) {
      int x = i;
      while (fa[x]) {
        x = fa[x];
        if (sn[x] == -1) et();
        sn[x] = 1;
      }
    }
  for (int i = 0; i <= cnt; i++)
    if (sn[i] == -1) {
      int x = i;
      while (fa[x]) {
        if (sn[fa[x]] == 1) break;
        sn[x] = 0;
        x = fa[x];
        sn[x] = -1;
      }
    }
  dfs(1, 0, 0);
  printf("%d\n", ans.size());
  int M = (1 << 8) - 1;
  for (auto p : ans) {
    unsigned int x = p.first;
    int a = x >> 24;
    int b = (x >> 16) & M;
    int c = (x >> 8) & M;
    int d = x & M;
    printf("%d.%d.%d.%d/%d\n", a, b, c, d, p.second);
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
